Skip to content

Add dotenv-override setting #2785

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

Merged
merged 8 commits into from
Jul 1, 2025
Merged

Add dotenv-override setting #2785

merged 8 commits into from
Jul 1, 2025

Conversation

Lun4m
Copy link
Contributor

@Lun4m Lun4m commented Jun 20, 2025

Closes #733

It's maybe too naive? I added some basic tests, but can you think of other edge cases I should test?
I also need to add some documentation I guess.

@mikeyhew
Copy link

@Lun4m What's your use case for this feature? I don't see a comment from you in the linked issue.

This seems compatible with #2682 but there will be merge conflicts and it will be important we have good test cases for both features

For what it's worth, if this config option does get added, I think dotenv-takes-precedence would be a clearer name.

@casey casey enabled auto-merge (squash) July 1, 2025 07:18
@casey
Copy link
Owner

casey commented Jul 1, 2025

Seems reasonable to me! I notice that the original issue has eight thumbs up, so it seems like something people want.

I made some changes:

  • Added documentation to the readme
  • Passed in the whole Settings file instead of just the bool. I think this is slightly less error prone, since it avoids a bug where you pass in the wrong bool to a function.
  • Made it so that if dotenv-override is set, environment file loading is trigger, since this is the behavior of existing environment file settings

@casey casey merged commit 876b402 into casey:master Jul 1, 2025
6 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.

Option for .env variables to override existing
3 participants