Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
// in bootstrap.yml is defined = /config and client microservice call to
// So in UrlMappings we need write our
// mapping for call - get "/config/${serviceName}/${profile}"(controller: 'configuration', action: 'config')
def config(String serviceName, String profile) {
def propertySources = [:] = "${serviceName}.properties"
propertySources.source = [:]
// read from db all configurations for requested service
["application", "application-${profile}", "${serviceName}-${profile}"].each { configName ->
Configuration configuration = Configuration.findByName(configName)
if (configuration) {
configuration.configLines?.each { line ->
if (line) {
propertySources.source.put(line.label, line.value)
def environment = [name : "${serviceName}", profiles: ["${profile}"], "label": null, "version": null, "state": null,
propertySources: [propertySources]]
render(text: environment as JSON, contentType: "application/json")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.