'How to access file in Spring Boot Cloud Config from another branch
When connecting to a git-configured spring boot cloud config server, how do you reference a different branch?
Currently I can access a subfolder's data by doing curling localhost:4001/myservicename/default
. Where the myservicename
is a subdirectory, with my application.properties includes the subfolder: spring.cloud.config.server.git.searchPaths=myservicename
The current default-label is: spring.cloud.config.server.git.default-label=main
Solution 1:[1]
Like @spencergibb answered you can access the branch using next link:
localhost:4001/myservicename/default/branch
To explain this link
<server ip/fqdn>:<port>/<service name>/<profile name>/<branch name>
A little more info: To have different profile versions you need to create files like this
app-name-<profile>.properties
Now to access different branch from spring code you need to add next line to application.properties file
spring.cloud.config.label=<branch
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Andrey Dobrikov |