I have three environments blocks in my Grails config file similar to this:
environments {
production {
grails.serverURL = "https://www.mysite.com"
}
development {
grails.serverURL = "http://localhost:8080/${appName}"
}
test {
grails.serverURL = "http://localhost:8080/${appName}"
}
}
... // more code
environments {
production {
authnet.apiId = "123456"
authnet.testAccount = "false"
}
development {
authnet.apiId = "654321"
authnet.testAccount = "true"
}
test {
authnet.apiId = "654321"
authnet.testAccount = "true"
}
}
... // more code
environments {
production {
email.sales = 'sales@mysite.com'
}
development {
email.sales = 'test@mysite.com'
}
test {
email.sales = 'test@mysite.com'
}
}
Somewhere in a controller:
println grailsApplication.config.grails.serverURL
println grailsApplication.config.authnet.apiId
println grailsApplication.config.email.sales
It prints out:
http://localhost:8080/myapp
[:]
test@mysite.com
So for some reason the app can't get data from some environments blocks. The stuff outside of environments blocks is fine. I noticed this issue with several different apps, different configs etc. Tried getting it with both grailsApplication and ConfigurationHolder. Is it a Grails bug or I'm doing something wrong? I'm running Grails 1.3.6