spring-cloud-config
spring-cloud-config copied to clipboard
Multiple labels with JDBC not working
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.
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?
Will check and let you know
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?
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?
Nope, i didn’t get 500. I got empty response as said
@ryanjbaxter I believe, currently, none of the environment repositories support multiple labels. Is there any doc/spec about such feature?
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
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.
Yes it is clearly not supported today.