Harden production against NODE_ENV environment variable (#2010)
Fixes #1999
This commit is contained in:
parent
9d9991e0f3
commit
3f0354f09e
1 changed files with 8 additions and 2 deletions
|
@ -2,8 +2,14 @@ const path = require('path');
|
||||||
|
|
||||||
const electronIsDev = require('electron-is-dev');
|
const electronIsDev = require('electron-is-dev');
|
||||||
|
|
||||||
const defaultEnvironment = electronIsDev ? 'development' : 'production';
|
let environment;
|
||||||
const environment = process.env.NODE_ENV || defaultEnvironment;
|
|
||||||
|
// In production mode, NODE_ENV cannot be customized by the user
|
||||||
|
if (electronIsDev) {
|
||||||
|
environment = process.env.NODE_ENV || 'development';
|
||||||
|
} else {
|
||||||
|
environment = 'production';
|
||||||
|
}
|
||||||
|
|
||||||
// Set environment vars to configure node-config before requiring it
|
// Set environment vars to configure node-config before requiring it
|
||||||
process.env.NODE_ENV = environment;
|
process.env.NODE_ENV = environment;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue