Externalizing Grails Datasource configuration

前端 未结 4 1990
傲寒
傲寒 2020-11-27 14:37

Grails 1.x allows using external configuration files by setting the grails.config.locations directive. Is there a similar approach available for externalizi

4条回答
  •  一生所求
    2020-11-27 15:00

    The answer above does not really externalize configuration. He is close, but the configuration is still residing in the application. I would use a JVM environment var on startup of the application/server to point to a location outside the application where the external configuration resides. Read out the environment var in the config.groovy file and use it get the external configuration file. Something like this:

    def extConfig = System.properties.getProperty('ENVVAR');
    grails.config.locations = [ "file:${extConfig}/${appName}-config.groovy"]
    

提交回复
热议问题