in Config.groovy I see this:
// set per-environment serverURL stem for creating absolute links
environments {
production {
grails.serverURL = "http://www.changeme.com"
}
}
what is the correct way to access that at runtime?
in Config.groovy I see this:
// set per-environment serverURL stem for creating absolute links
environments {
production {
grails.serverURL = "http://www.changeme.com"
}
}
what is the correct way to access that at runtime?
here it is:
import org.codehaus.groovy.grails.commons.ConfigurationHolder
println ConfigurationHolder.config.grails.serverURL
alternatively, in controllers and tags, apparently this will work:
grailsApplication.config.grails.serverURL
I needed it in BootStrap, so option 1 was what I needed.
danb is on the right track. However, life gets a bit easier on your fingers if you do a nicer import:
import org.codehaus.groovy.grails.commons.ConfigurationHolder as CH
println CH.config.grails.serverURL