spring-cloud / spring-cloud/spring-cloud-config
Allowing to use query parameters as further filter to select the right Environment from EnvironmentRepository
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 2k
- Forks
- 1.3k
- Avg merge
- 2d 59m
- Merged PRs (30d)
- 16
Description
Problem
I have to access to config server besides springboot applications also from SPA (AngularJS).
I've used the REST api provided out-of-box from config server but the triad application/profile/label seem to me is not enough to express the complexity coming out from my requirements.
Requirements
Acquire configuration from the same app installed in different devices where configuration is different depending from deviceId and location
The natural solution that I've imaged was to call api like application/profile/label?device=x&location=y but I haven't found a simple way to achieve that.
Solution
The solution that I've figured out are:
- try to use
profileand/orlabellike Json object (eg.application/profile/{label:'',device:'',location:''}) - publish a custom endpoint from my config server
- Add a filter and use stuff like
ThreadLocal
Proposal
During this analysis I've figured out that if the Request object will be passed to findOne(String application, String profile, String label); method of EnvironmentRepository this allowing to use query parameters as further filter to select the right Environment
The proposal is to extends the EnvironmentRepository interface as show below
public interface EnvironmentRepository {
Environment findOne(String application, String profile, String label);
default Environment findOne(Request request, String application, String profile, String label) {
return findOne(application, profile, label);
}
}
and update ResourceController accordly with new interface
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the EnvironmentRepository interface and ResourceController, then inspect the existing findOne implementations and how requests reach the controller. Determine how query parameters should be passed without breaking the current method, and consider the existing comment discussion before defining done as repository implementations being able to use the request data through the REST endpoint.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring, spring-boot
- Domain
- api, backend, cloud
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100