Remove redundance LOKI_DEV variable in scripts

This commit is contained in:
Mikunj 2020-03-26 16:15:34 +11:00
parent b97a68c7f6
commit 3f5a8e7b1b
3 changed files with 11 additions and 11 deletions

View file

@ -1,12 +1,14 @@
const path = require('path');
const electronIsDev = require('electron-is-dev');
const isDevelopment = require('electron-is-dev');
let environment;
// In production mode, NODE_ENV cannot be customized by the user
if (electronIsDev) {
if (isDevelopment) {
console.log('development');
environment = process.env.NODE_ENV || 'development';
process.env.LOKI_DEV = 1;
} else {
environment = 'production';
}
@ -23,7 +25,9 @@ if (environment === 'production') {
process.env.ALLOW_CONFIG_MUTATIONS = '';
process.env.SUPPRESS_NO_CONFIG_WARNING = '';
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '';
if (!process.env.LOKI_DEV) {
// We could be running againt production but still be in dev mode, we need to handle that
if (!isDevelopment) {
process.env.NODE_APP_INSTANCE = '';
}
}
@ -39,9 +43,6 @@ config.environment = environment;
'NODE_APP_INSTANCE',
'NODE_CONFIG_DIR',
'NODE_CONFIG',
'ALLOW_CONFIG_MUTATIONS',
'HOSTNAME',
'SUPPRESS_NO_CONFIG_WARNING',
].forEach(s => {
console.log(`${s} ${config.util.getEnv(s)}`);
});

View file

@ -57,7 +57,6 @@ module.exports = {
env: {
NODE_APP_INSTANCE: env,
NODE_ENV: 'production',
LOKI_DEV: 1,
USE_STUBBED_NETWORK: true,
ELECTRON_ENABLE_LOGGING: true,
ELECTRON_ENABLE_STACK_DUMPING: true,

View file

@ -18,10 +18,10 @@
"start": "electron .",
"start-multi": "cross-env NODE_APP_INSTANCE=1 electron .",
"start-multi2": "cross-env NODE_APP_INSTANCE=2 electron .",
"start-prod": "cross-env NODE_ENV=production NODE_APP_INSTANCE=devprod LOKI_DEV=1 electron .",
"start-prod-multi": "cross-env NODE_ENV=production NODE_APP_INSTANCE=devprod1 LOKI_DEV=1 electron .",
"start-swarm-test": "cross-env NODE_ENV=swarm-testing NODE_APP_INSTANCE=1 LOKI_DEV=1 electron .",
"start-swarm-test-2": "cross-env NODE_ENV=swarm-testing NODE_APP_INSTANCE=2 LOKI_DEV=1 electron .",
"start-prod": "cross-env NODE_ENV=production NODE_APP_INSTANCE=devprod electron .",
"start-prod-multi": "cross-env NODE_ENV=production NODE_APP_INSTANCE=devprod1 electron .",
"start-swarm-test": "cross-env NODE_ENV=swarm-testing NODE_APP_INSTANCE=1 electron .",
"start-swarm-test-2": "cross-env NODE_ENV=swarm-testing NODE_APP_INSTANCE=2 electron .",
"grunt": "grunt",
"icon-gen": "electron-icon-maker --input=images/icon_1024.png --output=./build",
"generate": "yarn icon-gen && yarn grunt",