-
-
Notifications
You must be signed in to change notification settings - Fork 23
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(robo): reload environment variables in dev mode #355
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@@ -308,7 +308,12 @@ export async function buildAsync(command: string | null, config: Config, verbose | |||
|
|||
logger.debug(`> ${pkgManager} ${args.join(' ')}`) | |||
const childProcess = spawn(pkgManager, args, { | |||
env: { ...process.env, FORCE_COLOR: '1' }, | |||
env: { | |||
// Only pass through essential vars, not the entire env |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mmm, I'm not sure if this is a good idea. There are several reasons why one would want environment variables to be inherited.
Example 1: Inline variables
Sometimes people pass environment variables inline as part of a script, either as a replacement or as an addition to .env
loading.
"dev": "NODE_ENV=test robo dev",
"start": "NODE_ENV=prod robo start"
Example 2: Doppler
This is a service I personally use a lot in organizations. Doppler replaces the need for .env
files. Similar to example 1, it injects variables to the process expecting it to be inherited.
"dev": "doppler run -- robo dev"
Passing only essential variables completely breaks the above two scenarios which are commonly used.
A major type-safe upgrade to our internal `env` now powered by a new `Env` class. This new class can be used to load variables as well as use them safely in a nested fashion.
For consistency with external APIs. We also now accept limited options.
Load functions now also return the newly loaded object. We'll be using this shortly.
This PR fixes environment variable reloading in dev mode by:
Fixes #302, #352