2

i have code in config.groovy

def ENV_NAME = "/home/myFolder"

if(System.getenv("ENV_NAME")) {
    println( "Including configuration file: " + System.getenv("ENV_NAME"));
    grails.config.locations << "file:" + System.getenv("ENV_NAME")
} else {
    println "No external configuration file defined."
}

When I run, the result is "No external configuration file defined." What do I miss?

Yuri
  • 4,254
  • 1
  • 29
  • 46
rsijaya
  • 159
  • 2
  • 14

1 Answers1

1

Presumably that there isn't an environment variable named ENV_NAME defined at the point when you ran the app.

Ian Roberts
  • 120,891
  • 16
  • 170
  • 183
  • hi ian, i got example from http://www.baselogic.com/blog/development/java-javaee-j2ee/getting-grails-external-configuration-working-in-the-real-world/ so i wonder to know how to define environment variable in config – rsijaya Jan 07 '13 at 08:34
  • It depends on the platform and the app server in question. Using Tomcat on Ubuntu I would set environment variables by editing `bin/catalina.sh` or the `/etc/init.d` script, I don't know how to do it on Windows. – Ian Roberts Jan 07 '13 at 09:34