Reputation: 224
Suppose in Config.groovy I specify my application property:
app.work.dir='/temp/work'
How can I refer to this property value to define other properties in the same Config.groovy file, i.e. this does not work because grailApplication.config has empty properties at this point:
app.resource.dir=grailsApplication.config.app.work.dir+'/static'
I know I can define a variable and then use this variable in both places, but it's really ugly, so I was hoping there is a cleaner way to do it.
Upvotes: 3
Views: 2296
Reputation: 22914
Variable substitution works in Config.groovy
. Here's an example taken from some actual production code:
external.config.base = '/known/config/file/path'
grails.config.locations = ["file:${external.config.base}/myapp-config.groovy"]
sitemap.file.path = "${external.config.base}"
Upvotes: 5