Skip to content

Commit 75fbdd6

Browse files
authored
secretsEnginePathMap -> public and copy map + helper methods
Also consider switching to https://immutables.github.io/ for builders
1 parent bfc926f commit 75fbdd6

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

src/main/java/com/bettercloud/vault/VaultConfig.java

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,21 @@ public VaultConfig token(final String token) {
151151
* "/secret/bar", "2"
152152
* @return This object, with secrets paths populated, ready for additional builder-pattern method calls or else finalization with the build() method
153153
*/
154-
VaultConfig secretsEnginePathMap(final Map<String, String> secretEngineVersions) {
155-
this.secretsEnginePathMap = secretEngineVersions;
154+
public VaultConfig secretsEnginePathMap(final Map<String, String> secretEngineVersions) {
155+
this.secretsEnginePathMap = new ConcurrentHashMap<>(secretEngineVersions);
156+
return this;
157+
}
158+
159+
/**
160+
* <p>Sets the secrets Engine version be used by Vault for the provided path.</p>
161+
*
162+
* @param path the path to use for accessing Vault secrets.
163+
* Example "/secret/foo"
164+
* @return This object, with a new entry in the secrets paths map, ready for additional builder-pattern method calls or else finalization with
165+
* the build() method
166+
*/
167+
public VaultConfig putSecretsEngineVersionForPath(String path, String version) {
168+
this.secretsEnginePathMap.put(path, version);
156169
return this;
157170
}
158171

0 commit comments

Comments
 (0)