Skip to content

Instantly share code, notes, and snippets.

@dtanner
Created April 30, 2015 05:32
Show Gist options
  • Save dtanner/6c337aa482f26659b2b5 to your computer and use it in GitHub Desktop.
Save dtanner/6c337aa482f26659b2b5 to your computer and use it in GitHub Desktop.
Example of loading a Grails configuration value from etcd
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