Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Custom Grails Environments?

Tags:

grails

build

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?

like image 237
tinny Avatar asked May 18 '10 22:05

tinny


1 Answers

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.

like image 142
leebutts Avatar answered Nov 09 '22 19:11

leebutts