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: use env to generate config.Environ() #414

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

fix: use env to generate config.Environ() #414

wants to merge 2 commits into from

Conversation

caarlos0
Copy link
Member

@caarlos0 caarlos0 commented Oct 31, 2023

this will use the env's OnSet to record the variable names and values in order to generate config.Environ() results.

The side effect I can think of: if the config values are changed outside of the env after loading, they'll not be applied.

I see we have yaml tags too... if we load the settings from yaml, and then from env (which seems to be the case), it should be fine.

Also changed a bunch of tests to use t.Setenv instead of os.Setenv/os.Unsetenv

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
@caarlos0 caarlos0 added the bug Something isn't working label Oct 31, 2023
@caarlos0 caarlos0 self-assigned this Oct 31, 2023
@caarlos0 caarlos0 added enhancement New feature or request and removed bug Something isn't working labels Oct 31, 2023
Copy link

codecov bot commented Oct 31, 2023

Codecov Report

Attention: 3822 lines in your changes are missing coverage. Please review.

Comparison is base (050a0d1) 50.52% compared to head (fab443e) 47.54%.
Report is 74 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #414      +/-   ##
==========================================
- Coverage   50.52%   47.54%   -2.99%     
==========================================
  Files         107      154      +47     
  Lines        8209    13021    +4812     
==========================================
+ Hits         4148     6191    +2043     
- Misses       3767     6342    +2575     
- Partials      294      488     +194     
Files Coverage Δ
git/commit.go 42.85% <100.00%> (+17.85%) ⬆️
git/reference.go 40.00% <100.00%> (+7.85%) ⬆️
pkg/backend/backend.go 100.00% <100.00%> (ø)
pkg/backend/cache.go 68.75% <ø> (ø)
pkg/backend/context.go 85.71% <ø> (ø)
pkg/backend/settings.go 78.57% <ø> (ø)
pkg/config/config.go 80.00% <100.00%> (ø)
pkg/config/file.go 100.00% <ø> (ø)
pkg/config/ssh.go 100.00% <100.00%> (ø)
pkg/cron/cron.go 90.00% <100.00%> (ø)
... and 141 more

... and 1 file with indirect coverage changes

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant