diff --git a/README.md b/README.md index d0f4ae0..874d82a 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,7 @@ Add the following settings on $RDECK_BASE/etc/rundeck-config.properties rundeck.storage.provider.1.type=vault-storage rundeck.storage.provider.1.path=keys rundeck.storage.provider.1.config.prefix=rundeck +rundeck.storage.provider.1.config.secretBackend=secret rundeck.storage.provider.1.config.address=$VAULT_URL rundeck.storage.provider.1.config.token=$VAULT_TOKEN ``` diff --git a/src/main/java/io/github/valfadeev/rundeck/plugin/vault/ConfigOptions.java b/src/main/java/io/github/valfadeev/rundeck/plugin/vault/ConfigOptions.java index b9fd930..5efa42c 100644 --- a/src/main/java/io/github/valfadeev/rundeck/plugin/vault/ConfigOptions.java +++ b/src/main/java/io/github/valfadeev/rundeck/plugin/vault/ConfigOptions.java @@ -22,5 +22,6 @@ class ConfigOptions { static final String VAULT_APPROLE_AUTH_MOUNT = "approleAuthMount"; static final String VAULT_APPROLE_ID = "approleId"; static final String VAULT_APPROLE_SECRET_ID = "approleSecretId"; + static final String VAULT_SECRET_BACKEND = "secretBackend"; static final String VAULT_STORAGE_BEHAVIOUR = "storageBehaviour"; } diff --git a/src/main/java/io/github/valfadeev/rundeck/plugin/vault/DescriptionProvider.java b/src/main/java/io/github/valfadeev/rundeck/plugin/vault/DescriptionProvider.java index df72817..364fe08 100644 --- a/src/main/java/io/github/valfadeev/rundeck/plugin/vault/DescriptionProvider.java +++ b/src/main/java/io/github/valfadeev/rundeck/plugin/vault/DescriptionProvider.java @@ -141,6 +141,12 @@ static Description getDescription() { .description("Response read timeout, ms") .defaultValue("20") ) + .property(PropertyBuilder.builder() + .string(VAULT_SECRET_BACKEND) + .title("Secret Backend") + .description("The secret backend to use in vault") + .defaultValue("secret") + ) .property(PropertyBuilder.builder() .string(VAULT_STORAGE_BEHAVIOUR) .title("Storage Behaviour") diff --git a/src/main/java/io/github/valfadeev/rundeck/plugin/vault/VaultStoragePlugin.java b/src/main/java/io/github/valfadeev/rundeck/plugin/vault/VaultStoragePlugin.java index 5459e52..57ed42d 100644 --- a/src/main/java/io/github/valfadeev/rundeck/plugin/vault/VaultStoragePlugin.java +++ b/src/main/java/io/github/valfadeev/rundeck/plugin/vault/VaultStoragePlugin.java @@ -48,6 +48,7 @@ public VaultStoragePlugin() {} private String vaultPrefix; + private String vaultSecretBackend; private Logical vault; //if is true, objects will be saved with rundeck default headers behaivour private boolean rundeckObject=true; @@ -61,6 +62,8 @@ public Description getDescription() { @Override public void configure(Properties configuration) throws ConfigurationException { vaultPrefix = configuration.getProperty(VAULT_PREFIX); + vaultSecretBackend = configuration.getProperty(VAULT_SECRET_BACKEND); + vault = new VaultClientProvider(configuration) .getVaultClient() .logical(); @@ -73,7 +76,7 @@ public void configure(Properties configuration) throws ConfigurationException { } public static String getVaultPath(String rawPath, String vaultPrefix) { - return String.format("secret/%s/%s", vaultPrefix, rawPath); + return String.format("%s/%s/%s", vaultSecretBackend, vaultPrefix, rawPath); } private boolean isDir(String key) { diff --git a/version.properties b/version.properties index 0f492b6..f8f8339 100644 --- a/version.properties +++ b/version.properties @@ -1,2 +1,2 @@ -plugin.version.number=1.0.1-SNAPSHOT -rundeck.version.number=2.11.5 \ No newline at end of file +plugin.version.number=1.0.2-SNAPSHOT +rundeck.version.number=2.11.5