是否可以在Spring Cloud Config Server中配置多个git存储库

时间:2017-11-30 13:24:04

标签: spring spring-cloud spring-cloud-config

我想从多个git存储库中读取一些配置,例如:

spring:
  profiles:
    active: base, app1, app2
  cloud:
    config:
      server:
        base:
          uri: http://${GIT_HOST}/base/base.git
          username: ${GIT_USERNAME}
          password: ${GIT_PASSWORD}
        app1:
          uri: http://${GIT_HOST}/group1/app1.git
          username: ${GIT_USERNAME}
          password: ${GIT_PASSWORD}
        app2:
          uri: http://${GIT_HOST}/group2/app2.git
          username: ${GIT_USERNAME}
          password: ${GIT_PASSWORD}

启动时,我看到以下异常:

Caused by: java.lang.IllegalStateException: You need to configure a uri for the git repository

documentation显示了使用两个不同的repos,git和svn的示例。我们不能使用同一种多重回购吗?

1 个答案:

答案 0 :(得分:0)

由于您说的文档链接,svn之后的gitserver是类型,而不是个人资料。所以你不能使用base,app1,app2。 但在你的情况下,我认为你可以使用这种配置:document link

spring:
  cloud:
    config:
      server:
        git:
          uri: https://git/common/config-repo.git
          repos:
            team-a:
                pattern: team-a-*
                cloneOnStart: true
                uri: http://git/team-a/config-repo.git
            team-b:
                pattern: team-b-*
                cloneOnStart: false
                uri: http://git/team-b/config-repo.git
            team-c:
                pattern: team-c-*
                uri: http://git/team-a/config-repo.git