![](/img/trans.png)
[英]how do i read a string from a file up to a set character (for example reading the words “hello world ¬ this is a string” up to the¬) in python 3
[英]How do i set up a grails environment variable?
我的 d 驅動器中有一個文件夾。我在 controller.so 在 controller 中使用這個驅動器中的文件有它的環境變量。如何做到這一點
聽起來配置參數比環境變量更好。 Config.groovy
是環境感知的,因此您可以為開發、生產等指定不同的值。
environments {
production {
fileLocation = "D:/"
}
development {
fileLocation "/somewhere/else"
}
test {
fileLocation "/production/somewhere"
}
}
您可以通過以下方式讀取此參數的值:
def fileLocation = org.codehaus.groovy.grails.commons.ConfigurationHolder.config?.fileLocation
在 grails 1.4 ConfigurationHolder
已棄用,因此您應該使用以下方式讀取配置參數:
def fileLocation = grailsApplication.config.fileLocation
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.