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

Support search locations similar to spring cloud config

Open MCeDo opened this issue 6 years ago • 11 comments
trafficstars

how to configurate multiple config names so that I'm abled to use multiple keys from consul config to start my project? like this: spring.cloud.consul.config.name=mysql,rabbitmq,zipkin,${spring.application.name} then, I can read multiple key's value to configurate my project?

Official introduction is config/testApp,dev/ config/testApp/ config/application,dev/ config/application/

MCeDo avatar Jan 08 '19 05:01 MCeDo

Does that configuration not work?

spencergibb avatar Jan 29 '19 00:01 spencergibb

I also came across with the same scenario where i need to load configs from different files which have different path and different names.

/app/global/global.yml /app/app1/common.yml /app/app1/tech.yml /app/app1/product.yml

Nishant-sehgal avatar Feb 02 '19 17:02 Nishant-sehgal

@spencergibb is there any way to achieve this?

Nishant-sehgal avatar Feb 05 '19 11:02 Nishant-sehgal

@Nishant-sehgal did you try?

spring.cloud.consul.config.name=mysql,rabbitmq,zipkin,${spring.application.name}

spencergibb avatar Feb 06 '19 22:02 spencergibb

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

spring-projects-issues avatar Feb 13 '19 22:02 spring-projects-issues

let me check for the same. Will revert Back.

@Nishant-sehgal did you try?

spring.cloud.consul.config.name=mysql,rabbitmq,zipkin,${spring.application.name}

@spring-issuemaster yes i tried with the below changes. spring.cloud.consul.config.name=a1,a2,a3,a4 using the above config it is referring to below consul directory.

ConsulPropertySource {name='APP/config/a1,a2,a3,a4/'}. Which is not correct. morever if that works still file names are different in each folder how to provide multiple file names in the config.

Nishant-sehgal avatar Feb 15 '19 07:02 Nishant-sehgal

if my directory structure is this: /app/app1/props.yml

config used: in this case all my properties are in single file and this file is quite huge.

spring: cloud: consul: host: consul.mmt.mmt port: 8500 config: enabled: true data-key: props.yml format: yaml prefix: app/app1

new directory structure:

/app/global/global.yml /app/app1/common.yml /app/app1/tech.yml

i want to read all these 3 files common.yml,tech.yml,global.yml in my application.How to do that?

Nishant-sehgal avatar Feb 15 '19 07:02 Nishant-sehgal

We don't support subdirectories. You may be able to get something similar based on spring.profiles.active but it won't be in separate directories.

spencergibb avatar Feb 15 '19 17:02 spencergibb

so if it is supported then i need to do something like.

searchPaths: app/app1/,app/global/

and it can still have different file names in subdirectories?

while reading we have to provide data-key so that should not be used?

Nishant-sehgal avatar Feb 16 '19 09:02 Nishant-sehgal

You would be able to use substitutions like {application} instead of hard coded app names.

spencergibb avatar Feb 16 '19 14:02 spencergibb

what would be the data-key to be provided as we need to provide the same while dealing with yaml files.Since file names would be different in this case. Or it is not required it will auto scan all the files with the directory provided.

Nishant-sehgal avatar Feb 18 '19 06:02 Nishant-sehgal