Introduce Key-Value API version in spring.cloud.vault.kv configuration.

See gh-209.
This commit is contained in:
Mark Paluch
2018-06-12 10:53:33 +02:00
parent 9a52b1dbed
commit f93b78d07d
2 changed files with 13 additions and 2 deletions

View File

@@ -142,7 +142,9 @@ public class VaultBootstrapPropertySourceConfiguration implements InitializingBe
keyValueBackend, Arrays.asList(applicationContext
.getEnvironment().getActiveProfiles()));
if (keyValueBackend instanceof VaultKeyValueBackendProperties) {
if (keyValueBackend instanceof VaultKeyValueBackendProperties
&& ((VaultKeyValueBackendProperties) keyValueBackend)
.getBackendVersion() == 2) {
for (String context : contexts) {
secretBackendConfigurer.add(KeyValueSecretBackendMetadata.create(

View File

@@ -26,7 +26,7 @@ import org.springframework.util.StringUtils;
import org.springframework.validation.annotation.Validated;
/**
* Configuration properties for Vault using the generic backend.
* Configuration properties for Vault using the key-value backend.
*
* @author Mark Paluch
* @since 2.0
@@ -64,6 +64,15 @@ public class VaultKeyValueBackendProperties implements EnvironmentAware,
*/
private String applicationName = "application";
/**
* Key-Value backend version. Currently supported versions are:
* <ul>
* <li>Version 1 (unversioned key-value backend).</li>
* <li>Version 2 (versioned key-value backend).</li>
* </ul>
*/
private int backendVersion = 2;
@Override
public void setEnvironment(Environment environment) {