1
我有Config.groovy中代碼Grails的外部配置配置System.getenv
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."
}
當我運行,結果是「沒有定義外部配置文件」。 我想念什麼?
嗨伊恩,我從http://www.baselogic.com/blog/development/java-javaee-j2ee/getting-grails-external-configuration-working-in-the-real-world/得到了例子,所以我想知道如何在配置中定義環境變量 –
這取決於有問題的平臺和應用程序服務器。在Ubuntu上使用Tomcat我會通過編輯'bin/catalina.sh'或'/ etc/init.d'腳本來設置環境變量,我不知道如何在Windows上執行。 –
好的,謝謝羅伯茨。我完成了它 –