3

我正在尝试使用多个存储库设置我的应用程序-基于本地文件的一个用于开发/测试目的和一个用于生产的远程 git 存储库。

我为此目的使用以下 yaml -

spring:
  application:
    name: localRepoConfig
  cloud:
    config:
      server:
        git:
          uri: https://github.com/spring-cloud-samples/config-repo
          repos:
            development:
              pattern:
                - '*/development'
                - '*/staging'
              uri: https://github.com/development/config-repo          
        native:
          searchLocations: classpath:/config
server:
  port: 8888

但是,这不起作用,以下适用于本地回购 -

spring:
  application:
    name: localRepoConfig
  profiles:
    active: native
  cloud:
    config:
      server:
        native:
          searchLocations: classpath:/config
server:
  port: 8888

在遵循 Spring 文档和此处的一些帖子之后,我无法使这两个存储库发挥作用。如果有人能指出我正确的方向,将不胜感激。

4

2 回答 2

1

我在 bootstrap.yml 中使用以下配置进行了此操作-

spring: application: name: localRepoConfig profiles: active: native cloud: config: server: native: searchLocations: classpath:/config server: port: 8888

--- spring:
profiles: development cloud: config: server: git: uri: https://github.com/spring-cloud-samples/config-repo server: port: 8989

我现在可以在本机配置文件和开发配置文件之间切换。以下指南很有帮助 - kubecloud.io/guide-spring-cloud-config/

于 2016-08-12T03:51:03.780 回答
0

根据Spring Cloud Config上的文档,听起来 native 和 git 是互斥的,您不能将两者用于单个配置服务器。

于 2016-08-11T05:05:18.857 回答