Don’t pass through REACT_APP_* env vars (#688)

Summary:
We don’t use or want these. Injecting an arbitrary family of variables
from the client’s host environment seems like a Bad Idea.

Test Plan:
The usual `yarn start`, static site, and `yarn test --full` still work.

wchargin-branch: remove-reactapp-vars
This commit is contained in:
William Chargin 2018-08-16 11:33:43 -07:00 committed by GitHub
parent e531761a26
commit ae6e269d9d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 0 additions and 9 deletions

View File

@ -55,17 +55,8 @@ process.env.NODE_PATH = (process.env.NODE_PATH || "")
.map((folder) => path.resolve(appDirectory, folder)) .map((folder) => path.resolve(appDirectory, folder))
.join(path.delimiter); .join(path.delimiter);
// Grab NODE_ENV and REACT_APP_* environment variables and prepare them to be
// injected into the application via DefinePlugin in Webpack configuration.
const REACT_APP = /^REACT_APP_/i;
function getClientEnvironment() { function getClientEnvironment() {
const raw = {}; const raw = {};
for (const key of Object.keys(process.env)) {
if (REACT_APP.test(key)) {
raw[key] = process.env[key];
}
}
// Useful for determining whether were running in production mode. // Useful for determining whether were running in production mode.
// Most importantly, it switches React into the correct mode. // Most importantly, it switches React into the correct mode.
raw.NODE_ENV = process.env.NODE_ENV || "development"; raw.NODE_ENV = process.env.NODE_ENV || "development";