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(config)!: nested environment config overrides #157

Merged
merged 7 commits into from
Apr 22, 2023

Conversation

mackness
Copy link
Contributor

Description

Behavior related to overriding configuration for nested elements via environment variables changed in config-rs@v0.9. We need to use __ instead of _ separator to match nested fields. For details see rust-cli/config-rs#73.

Also added some documentation that mentions it's possible to use environment variables to override configuration.

How Has This Been Tested?

All tests are passing locally, I updated config::test::parse_config and added a couple more env override assertions. I also tested in a small sandbox project and observed the following:

history

commit 9d5ce9759e2fbedc48fbb23e22cdad74214c809a (HEAD -> main, tag: v1.0.3-rc1)
Author: Mack Solomon <macksol@gmail.com>
Date:   Tue Apr 18 22:14:30 2023 -0700

    feat(all): a feature

commit f5b5135793de7bacfdec9750ef9d535320aaa614 (tag: v1.0.2)
Author: Mack Solomon <macksol@gmail.com>
Date:   Tue Apr 18 22:13:35 2023 -0700

    fix(all): a fix

result (with fix)

➜  release-playground git:(main) ✗ export CLIFF_GIT__GIT__IGNORE_TAGS="v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+"    
➜  release-playground git:(main) ✗ ~/dev/git-cliff/target/release/git-cliff --latest                  
# Changelog

All notable changes to this project will be documented in this file.

## [1.0.2] - 2023-04-19

### Bug Fixes

- A fix

<!-- generated by git-cliff -->

We can see that the first RC tag in history is being ignored as expected so the env override worked! 🎊

Types of Changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation (no code change)
  • Refactor (refactoring production code)
  • Other

Checklist:

  • My code follows the code style of this project.
  • I have updated the documentation accordingly.
  • I have formatted the code with rustfmt.
  • I checked the lints with clippy.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@mackness mackness changed the title fix(config): nested environment config overrides fix(config)!: nested environment config overrides Apr 21, 2023
@mackness mackness force-pushed the fix/nested-env-overrides branch from 04296c4 to 2b7269c Compare April 21, 2023 06:21
@codecov-commenter
Copy link

codecov-commenter commented Apr 21, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: -0.44 ⚠️

Comparison is base (2d72125) 44.08% compared to head (070dbc1) 43.64%.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #157      +/-   ##
==========================================
- Coverage   44.08%   43.64%   -0.44%     
==========================================
  Files          12       12              
  Lines         565      573       +8     
==========================================
+ Hits          249      250       +1     
- Misses        316      323       +7     
Flag Coverage Δ
unit-tests 43.64% <100.00%> (-0.44%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
git-cliff-core/src/config.rs 37.50% <100.00%> (-2.50%) ⬇️

... and 2 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@mackness mackness marked this pull request as ready for review April 21, 2023 06:23
@mackness mackness requested a review from orhun as a code owner April 21, 2023 06:23
Copy link
Owner

@orhun orhun left a comment

Choose a reason for hiding this comment

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

LGTM!

@orhun orhun merged commit bb9a889 into orhun:main Apr 22, 2023
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