【发布时间】:2015-04-30 16:28:12
【问题描述】:
我有应用程序配置文件,这些文件继承自常见的 application.yml 配置。问题是我可以在不与其他配置合并的情况下获取一些资源吗?一些 yml 文件无需任何修改即可获得它?
谢谢
【问题讨论】:
标签: yaml spring-cloud
我有应用程序配置文件,这些文件继承自常见的 application.yml 配置。问题是我可以在不与其他配置合并的情况下获取一些资源吗?一些 yml 文件无需任何修改即可获得它?
谢谢
【问题讨论】:
标签: yaml spring-cloud
添加另一个没有 application.yml 通用配置文件的存储库(基于模式) - 对我有用。
config:
server:
git:
uri: http://host:port/configuration/git/app.git
username: configserver
password: password
repos:
data-config:
uri: http://host:port/configuration/data-config.git
username: configserver
password: password
pattern: data_*
【讨论】:
您也可以使用自 1.0.1 起的新 searchPaths 设置
config:
server:
git:
uri: http://host:port/configuration/git/app.git
repos:
team1-config:
uri: http://host:port/configuration/config.git
searchPaths: team1*
pattern: team1_*
team2-config:
uri: http://host:port/configuration/config.git
searchPaths: team2*
pattern: team2_*
通过使用 searchPath,您可以将所有内容保存在 config-repo 中,但分为不同的文件夹。可能每个文件夹用于不同的项目。
【讨论】: