title: Spring cloud server not accessing all profiles from Vault backend
body: <p>I am new to HashiCorp Vault and setting up spring cloud config server having Vault as a backend for storing secrets, keys, etc.</p>
  
  <p>The problem is I am able to access the secrets that are stored at default level like : </p>
  
  <pre><code>curl -X "GET" "http://localhost:8888/myapp/default" -H "X-Config-Token: XXX"
  </code></pre>
  
  <p>However, I am unable to access the profile specific secrets that I stored in Vault. No matter which profile I store the secrets in, the API always returns default values and not profile specific values.</p>
  
  <p>for e.g:</p>
  
  <pre><code>curl -X "GET" "http://localhost:8888/myapp/prod" -H "X-Config-Token: XXX"
  </code></pre>
  
  <p>Here are my secrets stored on dev instance of Vault(ver 1.1.3):</p>
  
  <pre><code>1. vault kv put secret/myapp foo=myappsdefault
  2. vault kv put secret/myapp/prod foo=myappsprod
  </code></pre>
  
  <p><strong>Spring cloud config server application.yml:</strong></p>
  
  <pre><code>spring:
    profiles:
      active: vault
    cloud.config.server.vault.kvVersion: 2
  server:
    port: 8888
  </code></pre>
  
  <p><strong>Spring cloud server pom.xml:</strong></p>
  
  <pre><code>            &lt;parent&gt;
                  &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
                  &lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt;
                  &lt;version&gt;2.0.6.RELEASE&lt;/version&gt;
                  &lt;relativePath/&gt;
              &lt;/parent&gt;
  
              &lt;properties&gt;
                  &lt;spring-cloud.version&gt;Finchley.SR2&lt;/spring-cloud.version&gt;
              &lt;/properties&gt;
  
              &lt;dependencies&gt;
                  &lt;dependency&gt;
                      &lt;groupId&gt;org.springframework.cloud&lt;/groupId&gt;
                      &lt;artifactId&gt;spring-cloud-config-server&lt;/artifactId&gt;
                  &lt;/dependency&gt;
  
                  &lt;dependency&gt;
                      &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
                      &lt;artifactId&gt;spring-boot-starter-test&lt;/artifactId&gt;
                      &lt;scope&gt;test&lt;/scope&gt;
                  &lt;/dependency&gt;
              &lt;/dependencies&gt;    
  </code></pre>
  
  <p><strong>Expected:</strong></p>
  
  <pre><code>curl -X "GET" "http://localhost:8888/myapp/prod" -H "X-Config-Token: XXX"
  
  {
  "name": "myapp",
  "profiles": [
    "prod"
  ],
  "label": null,
  "version": null,
  "state": null,
  "propertySources": [
    {
  "name": "vault:myapp",
  "source": {
  "foo": "myappsprod"
  }
  }
  ],
  }
  </code></pre>
  
  <p><strong>Actual:</strong></p>
  
  <pre><code>{
  "name": "myapp",
  "profiles": [
    "prod"
  ],
  "label": null,
  "version": null,
  "state": null,
  "propertySources": [
    {
  "name": "vault:myapp",
  "source": {
  "foo": "myappsdefault"
  }
  }
  ],
  }
  </code></pre>
  
  <p><strong>Here are vault outputs:</strong></p>
  
  <pre><code>vault kv get secret/myapp/prod
  
  
  === Data ===
  Key    Value
  ---    -----
  foo    myappsprod
  
  
  vault kv get secret/myapp
  
  === Data ===
  Key    Value
  ---    -----
  foo    myappsdefault
  </code></pre>
  
  <p>So the question becomes why is spring cloud server only querying default profile secrets and not environment specific?</p>
  
  <p>Just as a side note, the profiles are getting applied to GIT files that I stored in repo, while integrating the spring cloud server with GIT as backend and I am expecting something similar with Vault.</p>