From 30ab0b9618070ede191d87a101eb0a1cf63eb850 Mon Sep 17 00:00:00 2001
From: buildmaster application.properties, you can add spring.profiles.active=vault.
By default, the config server assumes that your Vault server runs at http://127.0.0.1:8200.
It also assumes that the name of backend is secret and the key is application.
All of these defaults can be configured in your config server’s application.properties.
-The following table describes configurable Vault properties:
| Name | Default Value |
|---|---|
host | 127.0.0.1 |
port | 8200 |
scheme | http |
backend | secret |
defaultKey | application |
profileSeparator | , |
![]() | Important |
|---|---|
All of the properties in the preceding table must be prefixed with |
All configurable properties can be found in org.springframework.cloud.config.server.environment.VaultEnvironmentRepository.
With your config server running, you can make HTTP requests to the server to retrieve +The following table describes configurable Vault properties:
| Name | Default Value |
|---|---|
host | 127.0.0.1 |
port | 8200 |
scheme | http |
backend | secret |
defaultKey | application |
profileSeparator | , |
kvVersion | 1 |
![]() | Important |
|---|---|
All of the properties in the preceding table must be prefixed with |
All configurable properties can be found in org.springframework.cloud.config.server.environment.VaultEnvironmentRepository.
Vault 0.10.0 introduced a versioned key-value backend (k/v backend version 2) that exposes a different API than earlier versions, it now requires a data/ between the mount path and the actual context path and wraps secrets in a data object. Setting kvVersion=2 will take this into account.
With your config server running, you can make HTTP requests to the server to retrieve values from the Vault backend. To do so, you need a token for your Vault server.
First, place some data in you Vault, as shown in the following example:
$ vault write secret/application foo=bar baz=bam $ vault write secret/myapp foo=myappsbar
Second, make an HTTP request to your config server to retrieve the values, as shown in the following example:
$ curl -X "GET" "http://localhost:8888/myapp/default" -H "X-Config-Token: yourtoken"
You should see a response similar to the following:
{ diff --git a/single/spring-cloud-config.html b/single/spring-cloud-config.html index 89b9925c..eaad4cd0 100644 --- a/single/spring-cloud-config.html +++ b/single/spring-cloud-config.html @@ -335,7 +335,7 @@ A secret is anything that to which you want to tightly control access, such as A For example, in your config server’sapplication.properties, you can addspring.profiles.active=vault.By default, the config server assumes that your Vault server runs at
http://127.0.0.1:8200. It also assumes that the name of backend issecretand the key isapplication. All of these defaults can be configured in your config server’sapplication.properties. -The following table describes configurable Vault properties:
Name Default Value host
127.0.0.1
port
8200
scheme
http
backend
secret
defaultKey
application
profileSeparator
,
Important All of the properties in the preceding table must be prefixed with
spring.cloud.config.server.vault.All configurable properties can be found in
org.springframework.cloud.config.server.environment.VaultEnvironmentRepository.With your config server running, you can make HTTP requests to the server to retrieve +The following table describes configurable Vault properties:
Name Default Value host
127.0.0.1
port
8200
scheme
http
backend
secret
defaultKey
application
profileSeparator
,
kvVersion
1
Important All of the properties in the preceding table must be prefixed with
spring.cloud.config.server.vault.All configurable properties can be found in
org.springframework.cloud.config.server.environment.VaultEnvironmentRepository.Vault 0.10.0 introduced a versioned key-value backend (k/v backend version 2) that exposes a different API than earlier versions, it now requires a
data/between the mount path and the actual context path and wraps secrets in adataobject. SettingkvVersion=2will take this into account.With your config server running, you can make HTTP requests to the server to retrieve values from the Vault backend. To do so, you need a token for your Vault server.
First, place some data in you Vault, as shown in the following example:
$ vault write secret/application foo=bar baz=bam $ vault write secret/myapp foo=myappsbarSecond, make an HTTP request to your config server to retrieve the values, as shown in the following example:
$ curl -X "GET" "http://localhost:8888/myapp/default" -H "X-Config-Token: yourtoken"You should see a response similar to the following:
{ diff --git a/spring-cloud-config.xml b/spring-cloud-config.xml index a4fe6547..177d3f36 100644 --- a/spring-cloud-config.xml +++ b/spring-cloud-config.xml @@ -620,6 +620,10 @@ The following table describes configurable Vault properties:profileSeparator + , +
@@ -627,6 +631,7 @@ The following table describes configurable Vault properties:+ kvVersion + 1 All of the properties in the preceding table must be prefixed with spring.cloud.config.server.vault .All configurable properties can be found in +org.springframework.cloud.config.server.environment.VaultEnvironmentRepository .Vault 0.10.0 introduced a versioned key-value backend (k/v backend version 2) that exposes a different API than earlier versions, it now requires a data/ between the mount path and the actual context path and wraps secrets in adata object. SettingkvVersion=2 will take this into account.With your config server running, you can make HTTP requests to the server to retrieve values from the Vault backend. To do so, you need a token for your Vault server.