From 625717f7adee1a8748c378703c805f24b7d90658 Mon Sep 17 00:00:00 2001 From: KevinMidboe Date: Wed, 20 Dec 2017 22:16:36 +0100 Subject: [PATCH] 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 _. --- seasoned_api/src/config/configuration.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/seasoned_api/src/config/configuration.js b/seasoned_api/src/config/configuration.js index c8aa9a2..bd9d4c3 100644 --- a/seasoned_api/src/config/configuration.js +++ b/seasoned_api/src/config/configuration.js @@ -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.`); }