4

I am trying to mix native and vault profile with config server backend:

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

when I start config server I curl for properties:

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

I got empty propertySources list:

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

but when I change my bootstrap file (remove vault profile):

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

It works: returning my properties:

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

I did tried with "order" flags but still nothing...

The only workaround I found is bootstrap with "composite" profile like this:

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

But still don't know why it does not work with multi profile configuration, and why vault is overriding my native properties....

SuperAndrew
  • 3,013
  • 1
  • 17
  • 10

0 Answers0