-
Notifications
You must be signed in to change notification settings - Fork 41
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
Inherit environment variables deemed safe by default #36
Conversation
* Environment variables to inherit by default, if an environment is not explicitly given. | ||
*/ | ||
export const DEFAULT_INHERITED_ENV_VARS = | ||
process.platform === "win32" |
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.
Some of these are unnecessary, I'd nuke:
ALLUSERSPROFILE, NUMBER_OF_PROCESSORS, OS, PATHEXT, TMP, WINDIR
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.
Will definitely defer to you, but here was my reasoning:
NUMBER_OF_PROCESSORS
: Maybe needed to set reasonable concurrency defaults (e.g., for thread pools)?OS
: Maybe needed for compatibility checks?TMP
: Seemed like the same thing asTEMP
, maybe applications incorrectly use one or the other
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.
OS is basically a legacy constant, it's always Windows_NT
, and TMP is also like, a legacy env var that shouldn't exist. NUMBER_OF_PROCESSORS you can probably keep but usually people use a platform API like os.cpus().length
on node
this._serverParams.env === undefined | ||
? {} | ||
: { ...this._serverParams.env }, | ||
env: this._serverParams.env ?? getDefaultEnvironment(), |
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.
Do we want to merge this? something like:
env: { ...this._serverParams.env, ...getDefaultEnvironment() }
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.
No, because then there's no way to clobber the default environment. Even if we flipped the order, it'd be very annoying to unset the default keys.
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.
I figure it's easy enough for callers to build their env on getDefaultEnvironment()
if they want to.
Will need to make the same changes in the Python SDK, but let's review this for correctness first.
To do
After merging