-
-
Notifications
You must be signed in to change notification settings - Fork 329
Fix context order when loading properties #195
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 context order when loading properties #195
Conversation
4d10a96
to
a9eb37f
Compare
a9eb37f
to
419e70d
Compare
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.
Hey @WtfJoke ,
thanks so much for your contribution if you could address the following comments.
Since this is an issue with SecretManager are you willing of doing the same fix?
|
||
@Test | ||
void getAutomaticContextsWithSingleProfile() { | ||
AwsParamStorePropertySources sut = new AwsParamStorePropertySources(properties, logMock); |
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.
Please rename to propertySource instead of sut
|
||
private final String defaultContextName = "application"; | ||
|
||
private final String defaultApplicationName = "messaging-service"; |
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.
Rename to APPLICATION_NAME if we are going to keep it as constant. Since it is not used anywhere except setUp I am thinking if there is a point to have it as a constant? We probably won't use it anywhere else in the future.
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'll inline the variable
@@ -52,6 +54,8 @@ public AwsParamStorePropertySources(AwsParamStoreProperties properties, Log log) | |||
|
|||
addProfiles(contexts, defaultContext, profiles); | |||
contexts.add(defaultContext + "/"); | |||
|
|||
Collections.reverse(contexts); |
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.
Instead of doing reverse, I think it is better to just put
addProfiles(contexts, defaultContext, profiles);
contexts.add(defaultContext + "/");
Before appContext
insertions.
There is no point in doing reverse if we control the order of insertion.
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.
True, good point
I'm actually already working on that 😄 Will do, wasnt sure if I should put it on a separate or on the same PR. But I think its better in the same (except you preferr otherwise). Will address your comments soon |
91b0b57
to
45b7b7d
Compare
45b7b7d
to
7bc75b9
Compare
Hey @MatejNedic |
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.
Thanks on making changes!
There are 2 small changes please apply them.
...tore-config/src/test/java/io/awspring/cloud/paramstore/AwsParamStorePropertySourcesTest.java
Outdated
Show resolved
Hide resolved
...ig/src/test/java/io/awspring/cloud/secretsmanager/AwsSecretsManagerPropertySourcesTests.java
Outdated
Show resolved
Hide resolved
7bc75b9
to
669a8ea
Compare
Done :) |
@MatejNedic I dont like to ping people, but is there anything left to do in order to get this merged? 🙃 |
@maciejwalkowiak @eddumelendez Could you please check PR out? |
Hello, any plans for releasing this fix, soon? :) |
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.
Thanks @WtfJoke for a fix! And apologies for late merge.
Glad it got merged eventually :) Thanks for taking care! |
Fixes gh-169
📢 Type of change
📜 Description
Reverse the context order when loading properties to preserve documented order (eg service specific context "wins" over more general application context)
💡 Motivation and Context
Fixes #169
💚 How did you test it?
By JUnit Test(s) and in a sample project WtfJoke/chaoskotlindemo/awsparamterstoreconfig
📝 Checklist
🔮 Next steps