Grails

"grails.config.locations" in Config.groovy does not work within an "environments" block

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Cannot Reproduce
  • Affects Version/s: 1.1.1
  • Fix Version/s: None
  • Component/s: Configuration
  • Labels:
    None
  • Environment:
    OS X, Linux

Description

If I wrap the assignment of "grails.config.locations" with an "environments" block it no longer gets assigned. If the assignment is not wrapped in an "environments" block then it seems to work fine.

grails.config.locations = ["classpath:${appName}-config.properties"]
println "grails.config.locations = ${grails.config.locations}"

results in:

grails.config.locations = [classpath:ws-config.properties]

However,

environments {
production {
grails.config.locations = ["classpath:${appName}-config.properties"]

}
development {
grails.config.locations = ["classpath:${appName}-config.properties"]
}
test {
grails.config.locations = ["classpath:${appName}-config.properties"]

}
}
println "grails.config.locations = ${grails.config.locations}"

results in:

grails.config.locations = [:]

Activity

Hide
Luke Daley added a comment -

It seems like you are testing by printing the config value in the config script, which is never going to work.

I tried this out and the 'grails.config.locations' property is definitely resolved for the environment like any other config property.

Show
Luke Daley added a comment - It seems like you are testing by printing the config value in the config script, which is never going to work. I tried this out and the 'grails.config.locations' property is definitely resolved for the environment like any other config property.

People

Vote (0)
Watch (2)

Dates

  • Created:
    Updated:
    Resolved: