src: support override option in process.loadEnvFile#63197
Open
Han5991 wants to merge 2 commits intonodejs:mainfrom
Open
src: support override option in process.loadEnvFile#63197Han5991 wants to merge 2 commits intonodejs:mainfrom
Han5991 wants to merge 2 commits intonodejs:mainfrom
Conversation
Collaborator
|
Review requested:
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #63197 +/- ##
==========================================
- Coverage 90.03% 90.03% -0.01%
==========================================
Files 713 713
Lines 224950 224973 +23
Branches 42532 42534 +2
==========================================
+ Hits 202542 202562 +20
- Misses 14175 14187 +12
+ Partials 8233 8224 -9
🚀 New features to boost your workflow:
|
Add an opt-in `override` option to `process.loadEnvFile()` and a matching `--env-file-override-local` CLI flag, allowing values from `.env` files to replace existing variables in `process.env`. By default, existing environment variables continue to take precedence; callers must opt in explicitly. This lets a single process swap env-file contexts at runtime (integration tests, monorepo configurations) without manually parsing files via `util.parseEnv()`. Co-authored-by: Ilyas Shabi <[email protected]> Signed-off-by: sangwook <[email protected]>
Signed-off-by: sangwook <[email protected]>
c298987 to
8443aa9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds an opt-in
overrideoption toprocess.loadEnvFile()and a matching--env-file-override-localCLI flag, so callers can swap env-file contexts within one process lifetime (integration tests, monorepo configs).Default behavior — existing env vars take precedence — is unchanged (the contract from #49424).
Based on prior work in #52531 (rebased onto current main, with
Maybe<void>return type, lazygetValidatedPath, options-only overload detection, 7 new test cases).Refs: #63027
Refs: #52531