Externalizing Grails Datasource configuration

前端 未结 4 1991
傲寒
傲寒 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:17

    Just put the configuration file location as following in Config.groovy file

    grails.config.locations = [
                "file:/yourDirectory/${appName}/${Environment.current.name}-datasource.properties",
                "file:/yourDirectory/${appName}/${Environment.current.name}-config.groovy",
                "classpath:${appName}-${Environment.current.name}-datasource.properties",
                "classpath:${appName}-${Environment.current.name}-config.groovy"
        ]
    

    And put all the details about datasource and other config values in your appropriate file. Hence you can externalize the configuration and need not restart to change values.

提交回复
热议问题