是否可以使用多个复合存储库配置Spring Cloud Config?我们的设置使用了多个基于团队的存储库:
spring:
cloud:
config:
server:
git:
repos:
teamA:
cloneOnStart: true
pattern: teama-*
searchPaths: '{profile}'
uri: file:///etc/config/teama
teamB:
cloneOnStart: true
pattern: teamb-*
searchPaths: '{profile}'
uri: file:///etc/config/teamb
我们希望每个团队现在都从2个不同的git存储库中提取。我认为我们想要多个复合存储库(https://cloud.spring.io/spring-cloud-config/single/spring-cloud-config.html#composite-environment-repositories),但我不知道如何组合它们,甚至无法实现。
我希望每个团队都从两个存储库中提取配置数据,而不是仅仅从1中提取配置数据。
spring:
cloud:
config:
server:
git:
repos:
teamA:
repo1:
key1: repo1
key2: repo1
repo2:
key1: repo2
key2: repo2
答案 0 :(得分:0)
在这种情况下,您可以使用复合配置。下一步配置对我有用,客户端服务正在使用2个存储库中的属性
spring:
profiles:
active: composite
cloud:
config:
server:
composite:
-
type: git
cloneOnStart: true
uri: https://github.com/..../test-config
-
type: git
cloneOnStart: true
uri: https://github.com/..../test-config-2
您可能需要为每个配置“ searchPaths”。配置文件应为复合文件(至少一个配置文件)