Skip to content
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

Fix precedence for explicit sys prop and env var sources. #1002

Merged
merged 3 commits into from
Sep 9, 2019

Conversation

batsatt
Copy link
Contributor

@batsatt batsatt commented Sep 6, 2019

Fixes #977.

@batsatt batsatt self-assigned this Sep 6, 2019
@batsatt batsatt added bug Something isn't working SE labels Sep 6, 2019
@batsatt
Copy link
Contributor Author

batsatt commented Sep 6, 2019

@tomas-langer Note the comments in the tests that say "Implicit sources always take precedence"; this strikes me as wrong/backwards, but I'm assuming fixing it would be a breaking change.

String qualifiedName = "[" + name + "]";
for (ConfigSource source : sources) {
if (source instanceof MapConfigSource
&& source.description().contains(qualifiedName)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we rely on a description, you should also update the place the description is created to make sure it is not changed.
I would prefer a more deterministic way of finding these sources out - maybe wrapping them in a specific class (EnvVarConfigSource and SysPropConfigSource or similar) and looking for these types.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, agreed, this is a little fragile; I'm just about to lose internet for a couple of days, so will deal with this next week.

Copy link
Member

@tomas-langer tomas-langer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@batsatt batsatt merged commit dd4c851 into helidon-io:master Sep 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working SE
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Config.Builder ignores explicit ordering of systemProperties() and environmentVariables()
2 participants