Browse Source

Empty config value is not replaced by default value #380 (#381)

pull/1/head
rozetko 6 years ago committed by GitHub
parent
commit
7e56d07096
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      server/src/config.ts

5
server/src/config.ts

@ -37,7 +37,7 @@ export const ZMQ_CONNECTION_STRING = createZMQConnectionString();
function getConfigField(field: string, defaultVal?: any) {
let val = defaultVal;
let val;
if(process.env[field] !== undefined) {
val = process.env[field];
@ -50,8 +50,11 @@ function getConfigField(field: string, defaultVal?: any) {
}
if(val === undefined || val == '') {
if(defaultVal === undefined) {
throw new Error(`Please configure ${field}`);
}
return defaultVal;
}
return val;
}

Loading…
Cancel
Save