Now when checking config file if the value is blank it checks env variables for a variable defined as uppcase section + option with a separator of _.

This commit is contained in:
2017-12-20 22:16:36 +01:00
parent e4573e6808
commit 625717f7ad

View File

@@ -27,6 +27,11 @@ class Config {
const field = new Field(this.fields[section][option])
if (field.value === '') {
const envField = process.env[[section.toUpperCase(), option.toUpperCase()].join('_')]
if (envField !== undefined && envField.length !== 0) { return envField }
}
if (field.value === undefined) {
throw new Error(`${section} => ${option} is empty.`);
}