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 declarative config env substitution by disallowing '}' in default value #6793

Merged

Conversation

jack-berg
Copy link
Member

No description provided.

@jack-berg jack-berg requested a review from a team as a code owner October 15, 2024 18:44
@@ -634,6 +634,9 @@ private static java.util.stream.Stream<Arguments> envVarSubstitutionArgs() {
// Multiple environment variables referenced
Arguments.of("key1: ${STR_1}${STR_2}\n", mapOf(entry("key1", "value1value2"))),
Arguments.of("key1: ${STR_1} ${STR_2}\n", mapOf(entry("key1", "value1 value2"))),
Arguments.of(
"key1: ${STR_1} ${NOT_SET:-default} ${STR_2}\n",
mapOf(entry("key1", "value1 default value2"))),
Copy link
Member Author

Choose a reason for hiding this comment

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

Without this fix, this resolves to value1 default} ${STR_2.

The regex isn't able to differentiate between the } ending the second env var reference and the } ending the third reference.

Copy link

codecov bot commented Oct 15, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.10%. Comparing base (b1cd30e) to head (b137719).
Report is 6 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #6793      +/-   ##
============================================
- Coverage     90.12%   90.10%   -0.02%     
+ Complexity     6546     6545       -1     
============================================
  Files           728      728              
  Lines         19702    19702              
  Branches       1935     1935              
============================================
- Hits          17756    17753       -3     
  Misses         1347     1347              
- Partials        599      602       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jack-berg jack-berg merged commit 537f5c4 into open-telemetry:main Oct 16, 2024
17 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants