tags:

views:

49

answers:

2

I have been developing several Grails applications over the past couple of years. I am increasingly finding that the three grails environments (dev, test, prod) aren't enough to satisfy my needs. The more "enterprisey" your application gets, the more environments you tend to have.

I tend to use 6 environments for my development cycle...

DEVA //My dev
DEVB //Team mates dev
CI_TEST //CI like Hudson QA_TEST //Testing team environment
UAT_TEST //Customers testing environment
PROD //Production

Im wondering if there is a way to define custom Grails environments? I dont think there is, but the feature could be handy.

The way I am getting around this right now is by externalising the config to a properties file.

Id imagine that this is a pretty common requirement, so how have you been dealing with your environments?

A: 

One option could be to define a dataSource in DataSource.groovy for each of your environments and then store configuration information in the database.

You could then add code in BootStrap.groovy to load your configurations.

Lloyd Meinholz
Yeah could do something like that. But part of the problem is that there are many datasources. Usually one datasource per environment, of which there are 6
tinny
+4  A: 

Config.groovy and DataSource.groovy both support custom environments (I'm pretty sure most other config files do as well).

If you want to start up your app or package it for a custom env you use

grails -Dgrails.env=myCustomEnv run-app

Then in Config you would have

environments{
    myCustomEnv{
        myProp = 'myVal'
    }
}

I couldn't find a page in the user guide about it but we use them like this to have beta and uat environment settings.

leebutts
Works well, thanks! It surprises me that this isnt buried in the docs somewhere.
tinny
Yeah, if you have 5 minutes it would be good to raise and issue in Grails' JIRA requesting better doco on this.
leebutts