Skip to content

Add dotenv-override setting#2785

Merged
casey merged 8 commits intocasey:masterfrom
Lun4m:Add-dotenv-override
Jul 1, 2025
Merged

Add dotenv-override setting#2785
casey merged 8 commits intocasey:masterfrom
Lun4m:Add-dotenv-override

Conversation

@Lun4m
Copy link
Copy Markdown
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
Copy Markdown

@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
Copy Markdown
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