marko
marko

Reputation: 3776

Grails custom environments and web-apps

I'm asking to learn here so I might need a reality check so please, all input is welcome!

Let me describe the situation at hand here.

I have a Grails-project called, let's say - Forrest.

The idea is to give Forrest to different users, which may have different types of databases and branding (css and images), the delivery is then to be done by running say:

grails -Dgrails.env=user1 war

Forrest is to be given different environments in for example DataSource.groovy:

environments{
    user1{
        prop = 'user1'
    }
    user2{
        prop = 'user2'
    }
}

This is done so that customers can specify where they have their databases etc (not the idea way of doing it since it'll end up in a code repo and I don't know how configuration can be done by the user once they have the war-file).

What's also important is that I'm able to specify what environment uses what css-files and images. For exmaple, user1 might want green text whereas user2 wants blue text.

Any input on how I can control what is givem to whom or shall I reconsider?

Upvotes: 0

Views: 51

Answers (1)

Joshua Moore
Joshua Moore

Reputation: 24776

The best approach to this would be to externalize the configuration so that you can just hand them the WAR and they can place a configuration file (Groovy file) in the path to the application. No custom build process, no changes in the code, etc. Easy and clean.

Check out grails-app/conf/config.groovy for

grails.config.locations

Upvotes: 1

Related Questions