Search code examples
spring-cloud-config

Can I get single property values from Spring Cloud Config Server?


I would like to get single property values from Spring Cloud Config Server with a wget/curl call from the command line.

Single values because otherwise I have to parse them out of the response and I want to keep the bash-scripts as simple as possible.

The documentation of Spring Cloud Config Server states the possibilities of the REST API as follows

/{application}/{profile}[/{label}]
/{application}-{profile}.yml
/{label}/{application}-{profile}.yml
/{application}-{profile}.properties
/{label}/{application}-{profile}.properties

Is there any trick to get a single value? I searched quite a bit but found nothing. Not a huge need as it seems.

Or can I extend the EnvironmentController of the Config Server to implement this feature? I didn't found any resources about extending the REST API of the Config Server.

Thanks for your help


Solution

  • To answer my own question: Spring Config Server has some kind of template mechanism. With this you can basically serve whatever you want.

    In the documentation this is not very obvious because it is called Serving Plain Text: http://cloud.spring.io/spring-cloud-static/spring-cloud-config/1.3.4.RELEASE/single/spring-cloud-config.html#_serving_plain_text

    Even the example in the documentation is not serving plain text, but a structured configuration format.