我想通过命令行中的wget / curl调用从
Spring Cloud Config Server获取单个属性值.
单个值,因为否则我必须从响应中解析它们,并且我希望保持bash脚本尽可能简单.
Spring Cloud Config Server的文档说明了REST API的可能性,如下所示
/{application}/{profile}[/{label}]
/{application}-{profile}.yml
/{label}/{application}-{profile}.yml
/{application}-{profile}.properties
/{label}/{application}-{profile}.properties
获得单一价值有什么诀窍吗?我搜索了很多但没有发现任何东西.看起来并不是一个巨大的需求.
或者我可以扩展Config Server的EnvironmentController来实现此功能吗?我没有找到任何有关扩展Config Server的REST API的资源.
谢谢你的帮助
最佳答案 回答我自己的问题:Spring Config Server有一些模板机制.有了这个,你基本上可以满足你的任何需求.
在文档中,这不是很明显,因为它被称为服务纯文本:
http://cloud.spring.io/spring-cloud-static/spring-cloud-config/1.3.4.RELEASE/single/spring-cloud-config.html#_serving_plain_text
甚至文档中的示例也不是纯文本,而是结构化配置格式.