My spring cloud config server is using JDBC as backend. My requirement is to use multiple labels to fetch config.
When fetching data using http://localhost:8888/test_app,test_app2/dev,prod/master
URL i am getting the following response
{
"name": "test_app,test_app2",
"profiles": [
"dev,prod"
],
"label": "master",
"version": null,
"state": null,
"propertySources": [
{
"name": "test_app2-prod",
"source": {
"name_dev": "rahul_dev9999"
}
},
{
"name": "test_app-prod",
"source": {
"name": "rahul"
}
},
{
"name": "test_app2-dev",
"source": {
"name_dev": "rahul_dev9999"
}
},
{
"name": "test_app-dev",
"source": {
"name_dev": "rahul_dev"
}
}
]
}
But getting empty response after adding another label, http://localhost:8888/test_app,test_app2/dev,prod/master,feature
{
"name": "test_app,test_app2",
"profiles": [
"dev,prod"
],
"label": "master,feature",
"version": null,
"state": null,
"propertySources": []
}
Is this supported by spring cloud config?
It is required when working on feature branch, i want all configs to be pulled from master label while certain config from feature label.
Comment From: ryanjbaxter
I believe it should be supported. Have you tried it using the native file system as a back end to see if that supports multiple labels?
Comment From: ats1999
Will check and let you know
Comment From: ats1999
Not working with file system backend as well
Spring cloud config server application.properties
spring.profiles.active=native
spring.cloud.config.server.native.searchLocations=/Users/ats1999/Desktop/projects/w3worker/config-service/config-server/src/main/resources/config
/Users/ats1999/Desktop/projects/w3worker/config-service/config-server/src/main/resources/config/auth-dev-master.properties
auth=auth.dev.master
Upon querying http://localhost:8888/auth/dev/master, i am getting empty output.
But once i removed master from auth-dev-master.properties
, i am getting the desired properties with or without label in http://localhost:8888/auth/dev/master
Is this desired behaviour?
Comment From: ryanjbaxter
No I don't think so. When I try this using a native backend I am getting a 500 back from the config server, is that not what you are seeing?
Comment From: ats1999
Nope, i didn’t get 500. I got empty response as said
Comment From: kvmw
@ryanjbaxter I believe, currently, none of the environment repositories support multiple labels. Is there any doc/spec about such feature?
Comment From: ryanjbaxter
There isn't much, but there is this mention of using multiple labels in the docs
For instance, you might want to align the config label with your branch but make it optional (in that case, use spring.cloud.config.label=myfeature,develop).
I haven't checked other environment repositories other than JDBC and native
Comment From: blackr1234
You can check the code here:
JdbcEnvironmentRepository.java
The label
isn't converted into an array and iterated in a for
loop, unlike application
and profile
.
So multiple labels isn't supported in the latest GA version 4.1.3
.
Comment From: ryanjbaxter
Yes it is clearly not supported today.