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

Commit

Permalink
[#130]: Added rabbitmq prefix, to avoid conflicts with environment va…
Browse files Browse the repository at this point in the history
…riables.
  • Loading branch information
gevorg committed Jul 8, 2018
1 parent 436c9ed commit ab5ae2f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
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
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)
}
}

0 comments on commit ab5ae2f

Please sign in to comment.