Skip to content

The expand logic for env tag options has been modified, and the customOptions function has been refactored#349

Merged
caarlos0 merged 7 commits intocaarlos0:mainfrom
astak16:main
Dec 12, 2024
Merged

The expand logic for env tag options has been modified, and the customOptions function has been refactored#349
caarlos0 merged 7 commits intocaarlos0:mainfrom
astak16:main

Conversation

@astak16
Copy link
Copy Markdown
Contributor

@astak16 astak16 commented Dec 7, 2024

  1. If the environment variable key specified in env does not exist in the environment variables, and the key specified in envDefault is in the format of "${var}" or "$var", after being read, it is not replaced with the desired value.
  2. the merging of customOptions and options has been written as the mergeOptions function.

I’m not sure if you accept these two commits.

@codecov
Copy link
Copy Markdown

codecov bot commented Dec 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (52e7186) to head (8f2e342).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #349   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            3         3           
  Lines          625       618    -7     
=========================================
- Hits           625       618    -7     

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

@pull-request-size pull-request-size bot added size/L and removed size/M labels Dec 9, 2024
@astak16
Copy link
Copy Markdown
Contributor Author

astak16 commented Dec 9, 2024

Sorry, the two "fix: typo" commits were because I forgot to run the test cases.

@caarlos0 caarlos0 merged commit 6f3a5c0 into caarlos0:main Dec 12, 2024
@caarlos0
Copy link
Copy Markdown
Owner

thank you!

oxzi added a commit to oxzi/caarlos0-env that referenced this pull request Dec 18, 2024
The commit 6f3a5c0 from PR caarlos0#349, merged
between the last two releases, changed the parsing logic for Options,
especially allowing to merge map types. While this was already the case
for Options.FuncMap, this breaks the API promise of Options.Environment
to set "[e]nvironment keys and values that will be accessible for the
service". In particular, this allowed an environment bleed while
explicitly setting a custom environment, e.g., for testing purposes.

This change reverts merging a custom Options.Environment with the
default environment, if set.
caarlos0 pushed a commit that referenced this pull request Dec 20, 2024
The commit 6f3a5c0 from PR #349, merged
between the last two releases, changed the parsing logic for Options,
especially allowing to merge map types. While this was already the case
for Options.FuncMap, this breaks the API promise of Options.Environment
to set "[e]nvironment keys and values that will be accessible for the
service". In particular, this allowed an environment bleed while
explicitly setting a custom environment, e.g., for testing purposes.

This change reverts merging a custom Options.Environment with the
default environment, if set.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants