【发布时间】:2016-05-03 18:14:42
【问题描述】:
我正在考虑通过 Spring Cloud Config 实现 12factor 方法来外部化配置,但我无法使用 searchPaths 使通配符按我的预期工作。
文档http://cloud.spring.io/spring-cloud-config/spring-cloud-config.html#_spring_cloud_config_server 提到通配符 {application}、{label}、{profile} 可以在 searchPaths 变量中使用,以便 “您可以分隔路径中的目录,并选择一种策略,使适合您(例如每个应用程序的子目录,或每个配置文件的子目录)。"
我希望有一个 git 存储库,每个配置文件(然后是每个应用程序)有子目录,或者每个应用程序有子目录(然后按配置文件)。
例如
spring:
cloud:
config:
server:
git:
uri: https://stash.xxx.com.au/scm/xxx/config
searchPaths: {application}
or
searchPaths: {profile}
or
searchPaths: {application}/{profile}
但是,当我在 searchPaths 中使用任何通配符 {application} 或 {profile} 时,它在 git 存储库中找不到数据,或者连接选项根本无法启动。
有没有人可以参考这个工作的例子? 干杯 罗伊
【问题讨论】:
-
你没有说你使用的是什么版本的spring cloud config(这是最近的功能)。