Posts Tagged ‘properties’

Grials Externalizing properties

March 11, 2010

I wanted to add a properties files to the existing war file before app is deployed through a script.
Several steps
1) open the {appName}/grails-app/conf/Config.groovy
2) change “grails.config.locations” property in the file to

grails.config.locations = [“file:./grails-app/conf/${appName}-config.properties”]

3) create the {appName}-config.properties in

{appName}/grails-app/conf/

Possible problem: In war file, the properties file ends up in

WEB-INF\classes\

directory, so It might be better to just uncomment the
grails.config.locations existing already in step 2
Need to test.

Also see this site .

“The configuration mechanism of Grails is nice, but there is a small trouble. The configuration files are compiled and packed into the deployment package (WAR) during project build phase. However, one usually does not want to rebuild the whole application just to change say a database password. So, how to do it? “

This could be another option — but the problem is given a war file in tomcat how does one access those files
Does the

“file:${userHome}/.grails/${appName}-config.properties”

for the property ” “grails.config.locations” take care of it?
Need to test