-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(env): compatible with env variables ended with unescaped $ (#12031)
- Loading branch information
Showing
6 changed files
with
43 additions
and
24 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,19 +47,9 @@ export function loadEnv( | |
process.env.BROWSER_ARGS = parsed.BROWSER_ARGS | ||
} | ||
|
||
try { | ||
// let environment variables use each other | ||
expand({ parsed }) | ||
} catch (e) { | ||
// custom error handling until https://github.com/motdotla/dotenv-expand/issues/65 is fixed upstream | ||
// check for message "TypeError: Cannot read properties of undefined (reading 'split')" | ||
if (e.message.includes('split')) { | ||
throw new Error( | ||
'dotenv-expand failed to expand env vars. Maybe you need to escape `$`?', | ||
) | ||
} | ||
throw e | ||
} | ||
// let environment variables use each other | ||
// `expand` patched in patches/[email protected] | ||
expand({ parsed }) | ||
|
||
// only keys that start with prefix are exposed to client | ||
for (const [key, value] of Object.entries(parsed)) { | ||
|
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.