Spring Cloud Config - 多个复合存储库? [英] Spring Cloud Config - Multiple Composite Repositories?

查看:36
本文介绍了Spring Cloud Config - 多个复合存储库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用多个复合存储库配置 Spring Cloud Config?我们的设置使用多个基于团队的存储库:

Is it possible configure Spring Cloud Config with multiple composite repositories? Our setup uses multiple team-based repositories:

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) 是我们想要的,但我不知道如何将它们组合起来,或者如果可能的话.

We want each team to now pull from 2 different git repositories. I think multiple Composite repositories (https://cloud.spring.io/spring-cloud-config/single/spring-cloud-config.html#composite-environment-repositories) is what we want, but I can't figure out how to combine them, or if it is even possible.

我希望每个团队从两个 repos 中提取配置数据,而不仅仅是 1 个.在伪代码中:

I want each team to pull configuration data from two repos instead of just the 1. In pseudo code:

spring:
  cloud:
    config:
      server:
        git:
          repos:
            teamA:
              repo1:
                key1: repo1
                key2: repo1
              repo2:
                key1: repo2
                key2: repo2

推荐答案

在这种情况下,您可以使用复合配置.下一个配置对我有用,客户端服务使用来自 2 个存储库的属性

In this case your can use composite configuration. Next configuration is working for me, client service is using properties from 2 repositories

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".配置文件应该是复合的(至少有一个配置文件)

You may need to configure 'searchPaths' for each for your needs. Profile should be composite (at least one of profiles)

这篇关于Spring Cloud Config - 多个复合存储库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆