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: override configuration from flags only if set #865

Merged
merged 6 commits into from
Mar 30, 2024

Conversation

fmartingr
Copy link
Member

@fmartingr fmartingr commented Mar 23, 2024

This pull request checks if the flags provided to the server command has been set (are changed from the default values) before overriding the configuration with their values.

This fixes the configuration not being able to work when using only environment variables, since the default values were always overriden by the flags, regardless of being set up or not.

Ping @tenpai-git

Closes #844

@fmartingr fmartingr self-assigned this Mar 23, 2024
Copy link

codecov bot commented Mar 23, 2024

Codecov Report

Attention: Patch coverage is 0% with 19 lines in your changes are missing coverage. Please review.

Project coverage is 25.55%. Comparing base (595cb45) to head (397b772).
Report is 4 commits behind head on master.

❗ Current head 397b772 differs from pull request most recent head 3a929c6. Consider uploading reports for the commit 3a929c6 to get more accurate results

Files Patch % Lines
internal/cmd/server.go 0.00% 19 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #865      +/-   ##
==========================================
- Coverage   25.58%   25.55%   -0.04%     
==========================================
  Files          47       47              
  Lines        5628     5636       +8     
==========================================
  Hits         1440     1440              
- Misses       3989     3997       +8     
  Partials      199      199              

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

Copy link
Collaborator

@Monirzadeh Monirzadeh left a comment

Choose a reason for hiding this comment

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

LGTM and work fine in my system
can you check codecov error before merge this it decrease coverage

Copy link

@tenpai-git tenpai-git left a comment

Choose a reason for hiding this comment

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

Thank you @fmartingr! This looks good to me and is a better solution then deprecating SHIORI_HTTP_PORT.

@fmartingr fmartingr added this to the 1.6.1 milestone Mar 27, 2024
@fmartingr
Copy link
Member Author

LGTM and work fine in my system can you check codecov error before merge this it decrease coverage

Going to merge this for now so we can release a new dot version. I need to take a look at viper or something that allows us to have both flag and envvars easily.

@fmartingr fmartingr merged commit 9c7483f into master Mar 30, 2024
8 checks passed
@fmartingr fmartingr deleted the fix/env-override-server branch March 30, 2024 07:33
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.

3 participants