My app needs to run a job periodically, and I got the quartz2 plugin https://github.com/9ci/grails-quartz2 with one caveat.
In the tutorials page, it said to externalize the settings to something like grails.config.locations = [ "file:Quartz-config.groovy"] in your config.groovy.
Seems like a sensible idea...but for the life of me I couldn't get it to fetch the configs from an externalized source as described here: http://grails.org/doc/latest/guide/single.html#configExternalized
In the end, I gave up and just put my quartz config in Config.groovy. Probably not the ideal place to be but hopefully I'll figure it out and update you folks!
I managed to get the external config file(s) to work by:
ReplyDeleteConfig.groovy:
// There exists a JobConfig.groovy in the same folder with Config.groovy
// Multiple config files are loaded this way.
def commonConfigs = [
'Job',
//...
]
commonConfigs.each { String filenamePart ->
Class cls = Class.forName("${filenamePart}Config", true, Thread.currentThread().contextClassLoader)
grails.config.locations << cls
// for overriding things in individual dev env
grails.config.locations << "file:${userHome}/${appName}-${filenamePart}Config.groovy"
}