Could I override the grails.env during runtime

201 Views Asked by At

Grails seems to build the artefacts per env.

with the command "grails -Dgrails.env=test war

Is it possible for me to override the running environment programmatically?

The issue here is that we produce the war file using production env config. But I want to run the same war file in other environments, like Test, Staging, DR etc.

There are two options: 1. set grails.env in command line 2. programmatically set the current env in the code.

I wonder how could I achieve option2. Our deploy script is shared, not grails specific. There is a generic environment variable named SYSTEM is passed in command line. If I could map that env to the grails.env in code, that would be idea.

0

There are 0 best solutions below