spring-cloud / spring-cloud/spring-cloud-consul
Support multiple documents in a single YML file / KV
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 822
- Forks
- 539
- Avg merge
- 9h 31m
- Merged PRs (30d)
- 7
Description
I've been using Spring Cloud Config for a while but I'm looking into switching to Consul. Up to this point I have been storing multiple documents in a single YML file and taking advantage of Spring Cloud Config's ability to only add the documents that correspond to the active Spring profiles to the property source, but this does not appear to work with Spring Cloud Consul.
I have tried setting spring.cloud.consul.config.format: YAML and manually putting the multi-document YML files into Consul, as well as using the FILES setting and git2consul to just throw my files into Consul from Git, but in both cases the result is the same: the entire file is added to the property source rather than just the documents corresponding to the active profiles. Consequently, I've had to create new YML files for every profile or multiple KV entries in Consul for each profile (depending on how spring.cloud.consul.config.format is set).
Here's a simple example of the type of file I'm referring to:
server.port: 8999
---
spring.profiles: vm1
server.port: 8110
---
spring.profiles: vm2
server.port: 7013
Currently, I either have to create three separate files when using FILES, or three separate KV entries when using YAML.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at Spring Cloud Consul config handling for the YAML and FILES formats, using the multi-document example and active profiles described here as the reproduction case. Compare how the property source is assembled with the expected profile filtering. Done means only documents matching active profiles are added, while the default document remains available.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring
- Domain
- backend, cloud
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100