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

Multiple property sources?

Open
#311 7 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement help wanted
Dominant language
Java
Stars
822
Forks
539
Avg merge
9h 31m
Merged PRs (30d)
7

Description

I am trying to use Consul to get Kev/Value pairs during the bootstrap process of my application.
The folder structure on Consul looks like:
public/service-name
private/service-name
Note that there is no config folder anywhere over here.

I can manage to get my resources as :
config/public/service-name and
config/private/service-name
But that's not what I want.

I want the prefix to be empty. It is a nonEmpty value today. I can't override it to empty string and if I don't set it, it defaults to "config".
I am overriding defaultContext from "applications" to "public/service-name" but it prepends the prefix to it and ends up as config/public/service-name.

Is there any way to work around this problem?

My bootstrap looks like this and am trying to find workarounds to call private/service-name and public/service-name at bootstrap time.

spring:
    cloud:
        consul:
           enabled: true
           host: http://127.0.0.1    
           port: 8500
           config:
                prefix: ""
                name: private/service-name
                acl-token: xxx
                defaultContext: public/service-name

Thanks
Amrish

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 from the bootstrap YAML in the issue and trace how Consul config resolves prefix, name, and defaultContext. Compare the resulting paths with the requested public/service-name and private/service-name paths. Done means an empty prefix works at bootstrap or the supported workaround is documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring, spring-boot
Domain
backend, cloud
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.