【问题标题】:Could Spring Cloud Config Server be used for getting plain resource (not merged with application config)Spring Cloud Config Server 能否用于获取普通资源(未与应用程序配置合并)
【发布时间】:2015-04-30 16:28:12
【问题描述】:

我有应用程序配置文件,这些文件继承自常见的 application.yml 配置。问题是我可以在不与其他配置合并的情况下获取一些资源吗?一些 yml 文件无需任何修改即可获得它?

谢谢

【问题讨论】:

    标签: yaml spring-cloud


    【解决方案1】:

    添加另一个没有 application.yml 通用配置文件的存储库(基于模式) - 对我有用。

        config:
      server:
        git:
          uri: http://host:port/configuration/git/app.git
          username: configserver
          password: password
          repos:
             data-config:
                 uri: http://host:port/configuration/data-config.git
                 username: configserver
                 password: password
                 pattern: data_*
    

    【讨论】:

      【解决方案2】:

      您也可以使用自 1.0.1 起的新 searchPaths 设置

      config:
        server:
      git:
        uri: http://host:port/configuration/git/app.git
        repos:
           team1-config:
               uri: http://host:port/configuration/config.git
               searchPaths: team1*
               pattern: team1_*
           team2-config:
               uri: http://host:port/configuration/config.git
               searchPaths: team2*
               pattern: team2_*

      通过使用 searchPath,您可以将所有内容保存在 config-repo 中,但分为不同的文件夹。可能每个文件夹用于不同的项目。

      【讨论】:

        猜你喜欢
        • 2015-10-04
        • 2018-03-22
        • 2020-06-03
        • 2019-08-11
        • 2021-03-22
        • 2015-09-13
        • 2015-05-31
        • 2017-02-23
        • 2019-01-19
        相关资源
        最近更新 更多