spring-cloud / spring-cloud/spring-cloud-config
Requested name placeholder could be available when serving plain text files
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 2k
- Forks
- 1.3k
- Avg merge
- 2d 59m
- Merged PRs (30d)
- 16
Description
This is an enhancement request to be able to use the app "name" (from the URL /{name}/{profile}/{label}/{path}) when serving plain text files.
Use case
I want to make available a conf file or XML logging configuration file (plain text files) for use by applications that are not using the Spring Cloud Config client library. In these plain text files, I want certain values to contain the application's name. However, since the application (let's say "myapi") does not use the client library, there is no myapi.properties or myapi.yml file in the config repo.
Thus, when requesting http://my-config-server/myapi/dev/master/app.conf, the {name} "myapi" is not available for use like below.
app.conf:
LOG_FOLDER=/var/log/{name}
Workaround
Of course, adding a file myapi.properties (or myapi.yml) with a property like spring.application.name=myapi to the config repo will allow me to use ${spring.application.name} in the plain text file. However this adds the requirement of adding a properties file with this one value for every client that wants to use this common configuration file served as a plain text file. This could be avoided if the name path variable were available in the Environment resolving the placeholders.
Does this request seem like a worthwhile enhancement?
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 with the plain-text serving flow described in the linked Spring Cloud Config documentation and trace how the Environment resolves placeholders for requests such as /{name}/{profile}/{label}/{path}. The change is complete when the URL's name value can resolve {name} in a served plain-text file without requiring a client-specific properties or YAML file.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100