I have setup an environment variable like this:
APP_HOME = "c:\app\app-datasource.properties
in config.groovy I do
def ENV_NAME = "APP_HOME"
if(!grails.config.location || !(grails.config.location instanceof List)) {
grails.config.location = []
}
if(System.getenv(ENV_NAME)) {
println "Including configuration file specified in environment: " + System.getenv(ENV_NAME);
grails.config.location << "file:" + System.getenv(ENV_NAME)
} else if(System.getProperty(ENV_NAME)) {
println "Including configuration file specified on command line: " + System.getProperty(ENV_NAME);
grails.config.location << "file:" + System.getProperty(ENV_NAME)
} else {
println "No external configuration file defined."
}
I got this from a post online, I want to know if we need to use grails.config.location
or grails.config.locations
?
Also instead of APP_HOME
being set to the properties file directly, can I set it to a directory path (e.g.: c:\apps)
and then can I have multiple properties files placed in that directory, then if I do the following multiple times will it work?:
grails.config.locations << "file:" + System.getProperty(ENV_NAME)+ "\app-datasource.properties"
grails.config.locations << "file:" + System.getProperty(ENV_NAME)+ "\app-reporting.properties"
and so on...
Thanks in advance