Skip to content

Commit

Permalink
feat(config): add support for config keys starting with '_'
Browse files Browse the repository at this point in the history
  • Loading branch information
dmbch committed Jan 25, 2018
1 parent f5ccc11 commit 42272e5
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/config/lib/parse-env.js
Original file line number Diff line number Diff line change
Expand Up @@ -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] = {});
Expand Down

0 comments on commit 42272e5

Please sign in to comment.