Created
April 30, 2015 05:32
-
-
Save dtanner/6c337aa482f26659b2b5 to your computer and use it in GitHub Desktop.
Example of loading a Grails configuration value from etcd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import groovy.json.JsonSlurper | |
dataSource { | |
// most properties are directly set | |
pooled = true | |
// ... | |
// the url is retrieved from etcd...make sure the etcd resource is properly protected | |
def jsonSlurper = new JsonSlurper() | |
def catalogUrlConfig = jsonSlurper.parseText(new URL("http://etcdlocation:2379/v2/keys/dataSource/url").text) | |
url = catalogUrlConfig.node.value | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment