spring-cloud / spring-cloud-consul

Spring Cloud Consul
http://cloud.spring.io/spring-cloud-consul/
Apache License 2.0
813 stars 541 forks source link

Multiple property sources? #311

Open amrishdhoot opened 7 years ago

amrishdhoot commented 7 years ago

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

spencergibb commented 7 years ago

Please learn how to properly format code and logs.

amrishdhoot commented 7 years ago

Sure. Will do. Thanks for looking into this. So there is no workaround for specifying multiple source folders for consul today in spring-cloud-consul. Correct?

spencergibb commented 7 years ago

Not currently

spencergibb commented 7 years ago

duplicate of #303?

amrishdhoot commented 7 years ago

Would you mind if I submit a pull request for this?

Thanks, Amrish

bebers22 commented 3 years ago

Anything new here? For example prefix is config, application name is testApp I want to get configurations from multiple folders, something like searchPaths which config server support:

config/common/application.yml config/security/application-cloud.yml config/apps/testApp.yml Is it possible?

spencergibb commented 3 years ago

Nothing new. PRs welcome