spring-cloud-consul icon indicating copy to clipboard operation
spring-cloud-consul copied to clipboard

Add support for being able to set additional Consul tags via Env and System Properties

Open aantono opened this issue 7 years ago • 0 comments

Currently, if a spring.cloud.consul.discovery.tags property is set inside bootstrap.yml or inside application.yml files, it gets completely overridden by setting additional tags via command-line argument or Env variable, like setting SPRING_CLOUD_CONSUL_DISCOVERY_TAGS externally. This behavior breaks the intent of being able to augment the list of tags, not replacing them completely.

I've tried doing something like SPRING_CLOUD_CONSUL_DISCOVERY_TAGS="\${spring.cloud.consul.discovery.tags},external1=blah", but that has resulted in an infinite resolution loop [Circular placeholder reference 'spring.cloud.consul.discovery.tags' in property definitions] (rightfully so).

It would be great to be able to (somehow) augment the Consul Tags from external configs to add to the internally defined ones. (Maybe doing something "clever" like asking the environment for all the property sources and iterating over them in their configured precedence order from bottom to top, collecting all the tags for spring.cloud.consul.discovery.tags key and adding them all together)

aantono avatar Apr 28 '17 19:04 aantono