Guard against empty NODE_APP_INSTANCE

pull/1017/head
Mikunj 5 years ago
parent 57239932ba
commit b97a68c7f6

@ -8,7 +8,8 @@ const config = require('./config');
let storageProfile; let storageProfile;
const { NODE_ENV: environment, NODE_APP_INSTANCE:instance } = process.env; const { NODE_ENV: environment, NODE_APP_INSTANCE:instance } = process.env;
const isProduction = environment === 'production' && !instance; const isValidInstance = instance && instance.length > 0;
const isProduction = environment === 'production' && !isValidInstance;
// Use seperate data directories for each different environment and app instances // Use seperate data directories for each different environment and app instances
// We should prioritise config values first // We should prioritise config values first
@ -16,7 +17,7 @@ if (config.has(storageProfile)) {
storageProfile = config.get('storageProfile'); storageProfile = config.get('storageProfile');
} else if (!isProduction) { } else if (!isProduction) {
storageProfile = environment; storageProfile = environment;
if (instance) { if (isValidInstance) {
storageProfile = storageProfile.concat(`-${instance}`) storageProfile = storageProfile.concat(`-${instance}`)
} }
} }

Loading…
Cancel
Save