Skip to content
Snippets Groups Projects
Commit cbc44c82 authored by Sigmund, Dominik's avatar Sigmund, Dominik
Browse files

Fixed deep keys

parent 4a2c8abf
Branches
Tags
1 merge request!1Master
......@@ -41,7 +41,7 @@ module.exports = function() {
let keys = objectDeepKeys(config)
for (let index = 0; index < keys.length; index++) {
const element = keys[index]
let env = process.env[element.toUpperCase().replace('.', '_')]
let env = process.env[element.toUpperCase().replace(/\./g, '_')]
if (env) {
env = (env == 'true') ? true : env
env = (env == 'false') ? false : env
......
......@@ -13,6 +13,11 @@ let jsonLocals = {
setting:"localvalue",
another: {
more:"stuff"
},
even: {
deeper: {
key: 'sodeep'
}
}
}
......@@ -54,6 +59,7 @@ describe('config', function() {
process.env['SETTING'] = 'overwritten-by-env'
process.env['ANOTHER_MORE'] = 'overwritten-by-env2'
process.env['EVEN_DEEPER_KEY'] = 'overwritten-by-env3'
let config = new Config()
......@@ -62,6 +68,7 @@ describe('config', function() {
expect(config.setting).toBe('overwritten-by-env')
expect(config.another.more).toBe('overwritten-by-env2')
expect(config.even.deeper.key).toBe('overwritten-by-env3')
expect(config.another.setting).toBe('avalue')
})
})
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment