我可以拆分Grails的config.groovy文件吗? [英] Can I split config.groovy file of grails?
问题描述
由于 config.groovy
文件中存在敏感代码,所以恐怕我的朋友会在这个文件中犯下错误。当获取 svn 更新时,我们也会得到错误的配置代码。
As there is sensitive code in the config.groovy
file, I am afraid that my friends will commit with bugs in this file. When getting svn update, we too will get the buggy config code.
我可以将代码拆分为 config.groovy
,以便敏感代码保持不变,而另一个可以经常更改?
Can i split the code at config.groovy
in such a way that the sensitive code remains untouched and the other can be changed frequently?
推荐答案
类似于Marijn的回答。这是我通常设置Config.groovy的方式。我仍然使用它来进行一些设置,但任何环境(部署位置或单个机器)更改都可以覆盖Config.groovy中的任何设置。
Similar to Marijn's answer. This is how I usually set up my Config.groovy. I still use it for some settings, but anything environmentally (deployment location or individual machine) changing can override any settings in the Config.groovy.
Config.groovy >>> >
Config.groovy >>>>
grails.config.locations = [
"file:../app-config/myapp-dataSource.groovy",
"file:../app-config/myapp-config.groovy"
]
environments {
development {
grails.config.locations = [
"file:../myapp-config/myapp-dataSource.groovy",
"file:../myapp-config/myapp-config.groovy",
"file:${userHome}/myapp-config/myapp-dataSource.groovy",
"file:${userHome}/myapp-config/myapp-config.groovy"
]
some.config.setting=true
}
}
file:$ {userHome} /myapp-config/myapp-config.groovy >>>>
file:${userHome}/myapp-config/myapp-config.groovy >>>>
some.config.setting=false
这篇关于我可以拆分Grails的config.groovy文件吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!