From 42272e549772905070193f5a451ef52ad50a5b95 Mon Sep 17 00:00:00 2001 From: dmbch Date: Thu, 11 Jan 2018 22:02:27 +0100 Subject: [PATCH] feat(config): add support for config keys starting with '_' --- packages/config/lib/parse-env.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/config/lib/parse-env.js b/packages/config/lib/parse-env.js index c6b43d2ef..a5ff35efa 100644 --- a/packages/config/lib/parse-env.js +++ b/packages/config/lib/parse-env.js @@ -51,6 +51,10 @@ module.exports = function parseEnv(namespace) { Object.keys(process.env).reduce(function(result, key) { if (key.indexOf(prefix) === 0) { var segments = key.replace(prefix, '').split('_'); + if (!segments[0]) { + segments.shift(); + segments[0] = '_' + segments[0]; + } segments.reduce(function(result, segment, index) { if (index < segments.length - 1) { result = result[segment] || (result[segment] = {});