-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Add the full vault path to the PropertySource. #3180
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
Conversation
|
Can you add some tests that validate this fix? |
|
The existing tests already cover it (that's why they are failing). I'll add another commit with the adjusted tests tomorrow. |
94bb41e to
5edf3de
Compare
|
|
||
| if (properties != null && !properties.isEmpty()) { | ||
| environment.add(new PropertySource("vault:" + key, properties)); | ||
| var backendPath = "vault:" + (StringUtils.hasText(this.backend) ? this.backend + "/" : "") |
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.
I am a bit concerned about changing the name in a minor release because if someone is relying on the current schema this may break them. One thought I had would be to only change the name when there are multiple vault environment repositories configured so we fix the conflict, but leave the existing behavior in tact for every other case.
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.
Absolutely. In retrospect, submitting this PR a few months earlier would've solved this nicely.
Your suggestion is still a change for some users (i.e. those who have distinct keys in multiple vault sources), but there it is more likely they actually want the fixed behaviour.
As a migration path I could image adding a flag to include the full vault path (off by default) and change the default in the next major release. This would make the implementation simpler and fully backwards-compatible.
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.
I added a fullKeyPath property (defaulting to false) to the vault property source.
The previous behaviour as checked by the unit tests is unchanged and the new behaviour is checked by a new unit test.
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.
Thats fine, but we need documentation on the property and why someone would use it.
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.
Added in 9d48794
This allows clients to use properties from multiple vault sources that end in the same key, e.g. foo/bar/application and bar/baz/application Signed-off-by: Tristan Stenner <[email protected]>
…t path Signed-off-by: Tristan Stenner <[email protected]>
5edf3de to
95bfdf5
Compare
Signed-off-by: Tristan Stenner <[email protected]>
7910fbe to
9d48794
Compare
This allows clients to use properties from multiple vault sources that end in the same key, e.g.
foo/bar/applicationandbar/baz/application.Without this change, composite vault sources can't have the same key (application name, profile, …):
With this patch, the source name contains the full name (e.g.
vault:path/b/some-profile) similar to the yaml sources (e.g./root/path/app/application.yaml).