Skip to content
This repository has been archived by the owner on Jul 2, 2023. It is now read-only.

Commit

Permalink
Merge pull request #132 from gevorg/grails-3.x
Browse files Browse the repository at this point in the history
[#130]: Added rabbitmq prefix, to avoid conflicts with environment variables.
  • Loading branch information
budjb committed Jul 9, 2018
2 parents 436c9ed + ab5ae2f commit ff934a9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ gormVersion=6.0.12.RELEASE

org.gradle.daemon=true

version=3.4.4
version=3.4.5
group=org.grails.plugins

sourceCompatibility=1.8
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package com.budjb.rabbitmq.utils

import grails.config.Config
import org.grails.config.PrefixedConfig
import org.grails.config.PropertySourcesConfig

import java.util.regex.Matcher
Expand Down Expand Up @@ -43,15 +44,17 @@ trait ConfigPropertyResolver {
* @return a map with all values remapped where necessary
*/
Config fixPropertyResolution(Map map) {
return new PropertySourcesConfig((Map) map.collectEntries { k, v ->
PropertySourcesConfig config = new PropertySourcesConfig((Map) map.collectEntries { k, v ->
def val = v
if (val instanceof String) {
Matcher m = Pattern.compile(/\$\{(.+?)}/).matcher(val)
if (m.matches()) {
val = grailsConfiguration.get(m.group(1))
}
}
return [k, val]
return ['rabbitmq.' + k, val]
})

new PrefixedConfig('rabbitmq', config)
}
}

1 comment on commit ff934a9

@gevorg
Copy link
Contributor

@gevorg gevorg commented on ff934a9 Jul 9, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@budjb Thank You!, will you publish module?

Please sign in to comment.