-
Notifications
You must be signed in to change notification settings - Fork 224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multi level pfx path #189
Multi level pfx path #189
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,6 +36,7 @@ public class VaultConfig implements Serializable { | |
private SslConfig sslConfig; | ||
private Integer openTimeout; | ||
private Integer readTimeout; | ||
private int prefixPathDepth = 1; | ||
private int maxRetries; | ||
private int retryIntervalMilliseconds; | ||
private Integer globalEngineVersion; | ||
|
@@ -207,6 +208,57 @@ public VaultConfig readTimeout(final Integer readTimeout) { | |
return this; | ||
} | ||
|
||
/** | ||
* <p>Set the "path depth" of the prefix path. Normally this is just | ||
* 1, to correspond to one path element in the prefix path. To use | ||
* a longer prefix path, set this value | ||
* | ||
* @param prefixPathDepth integer number of path elements in the prefix path | ||
*/ | ||
public VaultConfig prefixPathDepth(int pathLength) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe rename this method |
||
if (pathLength < 1) { | ||
throw new IllegalArgumentException("pathLength must be > 1"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
} | ||
|
||
this.prefixPathDepth = pathLength; | ||
return this; | ||
} | ||
|
||
|
||
/** | ||
* <p>Set the "path depth" of the prefix path, by explicitly specifying | ||
* the prefix path, e.g., "foo/bar/blah" would set the prefix path depth | ||
* to 3. | ||
* | ||
* @param prefixPath string prefix path, with or without initial or | ||
* final forward slashes | ||
*/ | ||
public VaultConfig prefixPath(String prefixPath) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I suggest |
||
int orig = 0; | ||
int pos; | ||
int countElements = 0; | ||
int pathLen = prefixPath.length(); | ||
|
||
if (pathLen == 0) { | ||
throw new IllegalArgumentException("can't use an empty path"); | ||
} | ||
|
||
while ((orig < pathLen) && | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You could maybe simply call |
||
((pos = prefixPath.indexOf('/',orig)) >= 0)) { | ||
countElements++; | ||
orig = pos+1; | ||
} | ||
|
||
if (prefixPath.charAt(0) == '/') { | ||
countElements--; | ||
} | ||
if (prefixPath.charAt(pathLen-1) == '/') { | ||
countElements--; | ||
} | ||
|
||
return prefixPathDepth(countElements+1); | ||
} | ||
|
||
/** | ||
* <p>Sets the maximum number of times that an API operation will retry upon failure.</p> | ||
* | ||
|
@@ -245,6 +297,8 @@ void setEngineVersion(final Integer engineVersion) { | |
this.globalEngineVersion = engineVersion; | ||
} | ||
|
||
|
||
|
||
/** | ||
* <p>This is the terminating method in the builder pattern. The method that validates all of the fields that | ||
* has been set already, uses environment variables when available to populate any unset fields, and returns | ||
|
@@ -330,5 +384,8 @@ public String getNameSpace() { | |
return nameSpace; | ||
} | ||
|
||
public int getPrefixPathDepth() { | ||
return prefixPathDepth; | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
This is a great explanation, but it should probably be moved below in this
README.md
Maybe as a sub-section of Key Value Secret Engine Config
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Definitely agree with this. The placement of this text here is pretty bizarre, and future people reading the README will have no context of which PR/change this paragraph is talking about.
I'll re-work this myself, post-merge.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I intended for you to move it to release notes once a release number had been assigned.