在Spring云配置服务器上添加多个仓库

问题描述 投票:1回答:1

我需要在配置服务器上添加两个配置仓库。但是,它只选择一个配置库。谁能帮我解决这个问题。

配置服务器 bootstrap.yml

server:
 port: 8899
spring:
 cloud:
  config:
   server:
    git:
      uri: https://github.com/pocuser9x/wednest-config-store
      search-paths:
        - 'wednest-config-store/*service'
    repos:
      uri: https://github.com/pocuser9x/secure-config-store

https:/github.compocuser9xwednest-config-store。 我有以下文件

event-service.ymlevent-service-dev.ymlevent-service-stg.yml

这些文件是正确的挑选。

https:/github.compocuser9xsecure-config-store。 我有以下文件event-service-prod.yml这个文件没有被选中。

spring-boot spring-cloud spring-cloud-config-server
1个回答
0
投票

我想你要找的是复合仓库功能。它被记录在案 此处.

对你来说,这将是类似的东西。

spring:
  profiles:
    active: composite
  cloud:
    config:
      server:
        composite:
        -
          type: git
          uri: https://github.com/pocuser9x/wednest-config-store
          search-paths:
            'wednest-config-store/*service'

        -
          type: git
          uri: https://github.com/pocuser9x/secure-config-store

有一点需要注意的是,文档中的配置文件设置如上所述 但我发现需要使用 "include "而不是 "active"。Include是加法。

  profiles:
    include: composite
© www.soinside.com 2019 - 2024. All rights reserved.