-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Remove access to process.env from hot code paths #5657
Changes from 6 commits
0d7113c
8e1d2cc
61be692
34acf3f
15f7b30
e8b1f0d
ec9ea61
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,6 +29,7 @@ describe('runHttpQuery', () => { | |
query: '{ testString }', | ||
}, | ||
options: { | ||
debug: false, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was required to avoid returning a stack trace, which the test didn't expect. Without running through ApolloServer first, the |
||
schema, | ||
schemaHash: generateSchemaHash(schema), | ||
}, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -99,12 +99,5 @@ export interface Config<ContextFunctionParams = any> extends BaseConfig { | |
experimental_approximateDocumentStoreMiB?: number; | ||
stopOnTerminationSignals?: boolean; | ||
apollo?: ApolloConfigInput; | ||
// Apollo Server only uses process.env.NODE_ENV to determine defaults for | ||
// other behavior which have other mechanisms of setting explicitly. Sometimes | ||
// our tests want to test the exact logic of how NODE_ENV affects defaults; | ||
// they can set this parameter, but there's no reason to do so other than for | ||
// tests. Note that an explicit `__testing_nodeEnv__: undefined` means "act as | ||
// if the environment variable is not set", whereas the absence of | ||
// `__testing_nodeEnv__` means to honor the environment variable. | ||
Comment on lines
-102
to
-108
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Didn't think that this comment was necessary anymore, since I suppose you can consider |
||
__testing_nodeEnv__?: string | undefined; | ||
nodeEnv?: string; | ||
} |
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.
Not clear in the diff, but this is for the
trace
method. A production environment would still pay the cost for this check, even though it would eventually evaluate tofalse
and skip the tracing.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 guess this is fine. RESTDataSource hasn't been actively maintained in a little while (the current Apollo Server team has not yet ramped up on it; it's basically an entirely unrelated project that is very loosely coupled to Apollo Server). I don't know if anyone depends on the ability to set process.env.NODE_ENV at runtime (eg, potentially after this file is imported) and have it take effect. But if it breaks people we can revert it.