spring-cloud / spring-cloud/spring-cloud-consul

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

Open
#304 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

waiting for votes
Dominant language
Java
Stars
822
Forks
539
Avg merge
9h 31m
Merged PRs (30d)
7

Description

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)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing how the spring.cloud.consul.discovery.tags property is bound from bootstrap.yml, application.yml, environment variables, and command-line arguments through the Spring Environment. The work is done when external configuration augments internally defined Consul tags without causing circular placeholder resolution.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring-boot
Domain
backend, cloud
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.