views:

161

answers:

3

It seems that only grails.serverURL and grails.path are recognized as per environment configrautions. bla and foo are ignored and could not be used in application Anyone could solves this and provide a way to get bla and foo configured per environment?

environments {
    production {
        grails.serverURL = "http://alpha.foo.de"
        grails.path = ""
        bla = "text"
        foo= "word"
    }
    test {
        grails.serverURL = "http://test.foo.de"
        grails.path = ""
        bla = "othertext"
        foo= "otherword"
    }
}
A: 

All the ConfigSlurper variables are scoped by environment. What you've shown above should work fine.

When you use grails run-app, you are running in the development environment by default. Could that be your issue?

John Stoneham
A: 

Try...

> grails prod run-app

This should give you bla (text) and foo (word)

> grails test run-app

This should give you bla (othertext) and foo (otherword)

tinny
A: 

Config.groovy setting

environments {
    development {
        grails.serverURL = "http://alpha.foo.de"
        grails.path = "/bar"
        staticServerURL = "http://static.foo.de"
        staticPath = "/static"
    }
}

source code index.gsp

${grailsApplication.config.staticServerURL}a
${grailsApplication.config.staticPath}b
${grailsApplication.config.grails.serverURL}c
${grailsApplication.config.grails.path}d

what is printed out when started with grails run-app

a b http://alpha.foo.dec /bard
skurt