We have a use case where several of our services have a common set of shared resources (database, payment gateway urls, etc). We have other services that do not really care about those resources but also use the configuration server.
My options right now are to either: Duplicate those resources in each client's configuration or place those shared resources in application.yml where ALL services will end up getting that configuration.
I am looking for a way for the client to specify the name of its "shared" configuration. I think this would be as simple as adding an additional client property that allows the client to tell the server to look for an alternate shared file rather than the normal application.yml.
Service A ---\
------ shared_integration.yml
Service B ---/
Service C ---\
------ shared_sidecar.yml
Service D ---/
Comment From: dsyer
spring.cloud.config.name=serviceA,shared_integration
should work
Comment From: tkvangorder
Thanks Dave, I will give that a try.
Comment From: tkvangorder
Thanks Dave, this worked perfectly.
Comment From: vojtapol
This does not work anymore. What am I missing? Nothing on the config server side handles a list of application names. It will just search for application named serviceA,shared_integration
in this case.
Comment From: vojtapol
This does not work anymore. What am I missing? Nothing on the config server side handles a list of application names. It will just search for application named
serviceA,shared_integration
in this case.
Correction. This indeed does work as expected. I am not sure what was I missing previously. For future reference, here is where the split by comma happens. I would expect this to happen at a higher level of abstraction so that all implementations of EnvironmentRepository
support this out of the box but I guess there were reasons that made it impossible.
https://github.com/spring-cloud/spring-cloud-config/blob/main/spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/environment/JdbcEnvironmentRepository.java#L108