Use local var environment
rather than NODE_ENV
Traditionally, NODE_ENV refers to an environment variable. For clarity, let's keep it that way and don't reuse it in the renderer. Also, add a note about explicitly overriding env vars for node-config. // FREEBIE
This commit is contained in:
parent
e7e030a5e2
commit
a55c61a3ba
2 changed files with 6 additions and 3 deletions
|
@ -9,7 +9,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
console.log('background page reloaded');
|
console.log('background page reloaded');
|
||||||
console.log('NODE_ENV', window.config.NODE_ENV);
|
console.log('environment:', window.config.environment);
|
||||||
extension.notification.init();
|
extension.notification.init();
|
||||||
|
|
||||||
var initialLoadComplete = false;
|
var initialLoadComplete = false;
|
||||||
|
|
7
main.js
7
main.js
|
@ -27,7 +27,10 @@ if (shouldQuit) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const package_json = JSON.parse(fs.readFileSync(path.join(__dirname, 'package.json'), 'utf-8'))
|
const package_json = JSON.parse(fs.readFileSync(path.join(__dirname, 'package.json'), 'utf-8'))
|
||||||
process.env.NODE_ENV = package_json.environment || process.env.NODE_ENV || 'development';
|
const environment = package_json.environment || process.env.NODE_ENV || 'development';
|
||||||
|
|
||||||
|
// Set environment vars to configure node-config before requiring it
|
||||||
|
process.env.NODE_ENV = environment;
|
||||||
process.env.NODE_CONFIG_DIR = path.join(__dirname, 'config');
|
process.env.NODE_CONFIG_DIR = path.join(__dirname, 'config');
|
||||||
const config = require('config');
|
const config = require('config');
|
||||||
|
|
||||||
|
@ -70,7 +73,7 @@ function createWindow () {
|
||||||
version: package_json.version,
|
version: package_json.version,
|
||||||
buildExpiration: config.get('buildExpiration'),
|
buildExpiration: config.get('buildExpiration'),
|
||||||
serverUrl: config.get('serverUrl'),
|
serverUrl: config.get('serverUrl'),
|
||||||
NODE_ENV: process.env.NODE_ENV
|
environment: environment
|
||||||
}
|
}
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue