Can I split the config.groovy grails file?

Since config.groovythere is sensitive code in the file , I am afraid that my friends will make mistakes in this file. When we receive the svn update, we will also get a buggy error code.

Is it possible to divide the code by config.groovyso that the sensitive code remains intact, and the other can be changed frequently?

+5
source share
2 answers

Like Maryn’s answer. This is how I usually set up my Config.groovy. I still use it for some settings, but any change in the environment (deployment location or individual machine) can override any settings in 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 → →

some.config.setting=false
+4

:

grails.config.locations

, :

grails.config.locations << 'file:MyConfigFile.groovy'

.

. :  http://www.pasopas.nl/2012/loading-grails-configuration-files-update/

+6

All Articles