带有Vault的Spring Cloud Config Server-Vault覆盖了本机配置文件中的任何值

时间:2019-08-06 07:29:21

标签: spring-boot spring-cloud spring-cloud-config hashicorp-vault configserver

我正在尝试将本机配置文件和保管库配置文件与配置服务器后端混合使用:

spring:
  profiles:
    active: native, vault
  cloud:
    config:
      server:
        native:
          searchLocations: classpath:/abc
        vault:
          kv-version: 2

当我启动配置服务器时,我会卷曲属性:

curl -X "GET" "http://localhost:20000/appName/dev" -H "X-Config-Token: xxxxxxxx"

我的属性来源列表为空

{"name":"appName","profiles":["dev"],"label":null,"version":null,"state":null,"propertySources":[]}%

但是当我更改引导文件(删除保管库配置文件)时:

spring:
  profiles:
    active: native
  cloud:
    config:
      server:
        native:
          searchLocations: classpath:/abc
        vault:
          kv-version: 2

有效:返回我的属性:

{"name":"appName","profiles":["dev"],"label":null,"version":null,"state":null,"propertySources":[{"name":"classpath:/abc/appName-dev.yml","source":{"some.properties":"VALUE","....}

我确实尝试过使用“订单”标志,但仍然没有...

我发现的唯一解决方法是使用“复合”配置文件进行引导,如下所示:

spring:
  profiles:
    active: composite
  cloud:
    config:
      server:
        composite:
          -
            type: vault
            kv-version: 2
          -
            type: native
            searchLocations: classpath:/abc

但是仍然不知道为什么它不能与多配置文件配置一起使用,以及为什么Vault覆盖了我的本机属性。...

0 个答案:

没有答案