简体   繁体   English

具有Monorepo策略的Spring Cloud Config Git后端

[英]Spring Cloud Config Git Backend with a monorepo strategy

How do I configure Spring Cloud Config with a Git backend following a monorepo strategy? 遵循monorepo策略,如何使用Git后端配置Spring Cloud Config? Say, my repo name is mono-repo , and my application config lies in a feature branch feature/cloud-application-config , and the configurations are in a directory named application-config , how do I configure the Config Server to clone this repository and get config from this feature branch? 说,我的仓库名称是mono-repo ,我的应用程序配置位于功能分支feature/cloud-application-config ,并且这些配置位于名为application-config的目录中,如何配置Config Server来克隆此存储库并从此功能分支获取配置?

Adding the property spring.cloud.config.label=feature(_)cloud-application-config (which specifies the branch) in both the config server and its clients did the trick. 在配置服务器及其客户端中添加属性spring.cloud.config.label=feature(_)cloud-application-config (指定分支)可以解决问题。 But I also had to modify spring.cloud.config.server.git.searchPaths to : 但是我还必须将spring.cloud.config.server.git.searchPaths修改为:

spring:
  cloud:
    config:
      server:
        git:
          uri: ...
          searchPaths:
            - application-config
            - "application-config/{application}"

      label: feature(_)cloud-application-config

I had to add both paths to searchPaths because otherwise, it would not get the properties from the common application-<profile>.yml files, or from the directories which have the application name. 我必须将两个路径都添加到searchPaths,因为否则,它将无法从通用application-<profile>.yml文件或具有应用程序名称的目录中获取属性。

Spring Cloud Config Server - Git Backend Spring Cloud Config Server-Git后端

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM