How do I configure Spring Cloud Config with a Git backend following a monorepo strategy? Say, my repo name is mono-repo
, and my application config lies in a feature branch feature/cloud-application-config
, and the configurations are in a directory named application-config
, how do I configure the Config Server to clone this repository and get config from this feature branch?
Adding the property spring.cloud.config.label=feature(_)cloud-application-config
(which specifies the branch) in both the config server and its clients did the trick. But I also had to modify spring.cloud.config.server.git.searchPaths
to :
spring:
cloud:
config:
server:
git:
uri: ...
searchPaths:
- application-config
- "application-config/{application}"
label: feature(_)cloud-application-config
I had to add both paths to searchPaths because otherwise, it would not get the properties from the common application-<profile>.yml
files, or from the directories which have the application name.