nconf
Advanced tools
Comparing version 0.9.1 to 0.10.0
v0.10.0 / Mon, 18 Dec 2017 | ||
========================== | ||
* [0ef652e](https://github.com/projects/nconf/commit/0ef652e) 0.10.0 (`Matt Hamann`) | ||
* [01f25fa](https://github.com/projects/nconf/commit/01f25fa) Regex as env separator (#288) (`Adrien Becchis`) | ||
* [16667be](https://github.com/projects/nconf/commit/16667be) Argv store separator (#291) (`Adrien Becchis`) | ||
v0.9.1 / Fri, 3 Nov 2017 | ||
======================== | ||
* [806f1b1](https://github.com/projects/nconf/commit/806f1b1) 0.9.1 (`Matt Hamann`) | ||
* [bac910a](https://github.com/projects/nconf/commit/bac910a) 0.9.1 (`Matt Hamann`) | ||
* [2bdf7e1](https://github.com/projects/nconf/commit/2bdf7e1) Clean Argv Store options (#290) (`Adrien Becchis`) | ||
@@ -6,0 +12,0 @@ * [b9321b2](https://github.com/projects/nconf/commit/b9321b2) transformer can now return an undefined key (#289) (`Adrien Becchis`) |
@@ -38,3 +38,8 @@ /* | ||
} | ||
if (typeof options.separator === 'string' || options.separator instanceof RegExp) { | ||
this.separator = options.separator; | ||
delete options.separator; | ||
} else { | ||
this.separator = ''; | ||
} | ||
}; | ||
@@ -90,3 +95,8 @@ | ||
self.set(key, val); | ||
if (self.separator) { | ||
self.set(common.key.apply(common, key.split(self.separator)), val); | ||
} | ||
else { | ||
self.set(key, val); | ||
} | ||
} | ||
@@ -93,0 +103,0 @@ }); |
@@ -38,3 +38,3 @@ /* | ||
} | ||
if (typeof(options) === 'string') { | ||
if (typeof(options) === 'string' || options instanceof RegExp) { | ||
this.separator = options; | ||
@@ -41,0 +41,0 @@ } |
{ | ||
"name": "nconf", | ||
"description": "Hierarchical node.js configuration with files, environment variables, command-line arguments, and atomic object merging.", | ||
"version": "0.9.1", | ||
"version": "0.10.0", | ||
"author": "Charlie Robbins <charlie.robbins@gmail.com>", | ||
@@ -6,0 +6,0 @@ "contributors": [ |
@@ -26,2 +26,4 @@ /* | ||
process.env.json_obj = JSON.stringify({foo: 'bar', baz: 'foo'}); | ||
process.env.NESTED__VALUE = 'nested'; | ||
process.env.NESTED___VALUE_EXTRA_LODASH = '_nested_'; | ||
@@ -301,2 +303,26 @@ vows.describe('nconf/multiple-stores').addBatch({ | ||
} | ||
}).addBatch({ | ||
// Threw this in it's own batch to make sure it's run separately from the | ||
// sync check | ||
"When using env with a bad transform:fn": { | ||
topic: function () { | ||
var that = this; | ||
helpers.cp(complete, completeTest, function () { | ||
try { | ||
nconf.env({ separator: /__+/ }); | ||
that.callback(); | ||
} catch (err) { | ||
that.callback(null, err); | ||
} | ||
}); | ||
}, "env vars": { | ||
"can access to nested values": function(err) { | ||
assert.deepEqual(nconf.get('NESTED'), {VALUE:'nested', VALUE_EXTRA_LODASH: '_nested_'}); | ||
} | ||
} | ||
}, | ||
teardown: function () { | ||
nconf.remove('env'); | ||
} | ||
}).export(module); |
@@ -114,3 +114,39 @@ /* | ||
}, | ||
"configured with .file(), .defaults() should deep merge objects": { | ||
"configured with .argv() and separator, .file() and invoked with nested command line options": { | ||
topic: function () { | ||
var script = path.join(__dirname, 'fixtures', 'scripts', 'nconf-hierarchical-load-merge-with-separator.js'), | ||
argv = ['--candy--something', 'foo', '--candy--something5--second', 'bar'], | ||
that = this, | ||
data = '', | ||
child; | ||
process.env.candy__bonbon = 'sweet'; | ||
child = spawn('node', [script].concat(argv)); | ||
delete process.env.candy__bonbon; | ||
child.stdout.on('data', function (d) { | ||
data += d; | ||
}); | ||
child.on('close', function() { | ||
that.callback(null, data); | ||
}); | ||
}, | ||
"should merge nested objects ": function (err, data) { | ||
console.log(data) | ||
assert.deepEqual(JSON.parse(data), { | ||
apples: true, | ||
candy: { | ||
bonbon: 'sweet', | ||
something: 'foo', | ||
something1: true, | ||
something2: true, | ||
something5: { | ||
first: 1, | ||
second: 'bar' | ||
} | ||
} | ||
}); | ||
} | ||
}, | ||
"configured with .file(), .defaults() should deep merge objects": { | ||
topic: function () { | ||
@@ -117,0 +153,0 @@ var script = path.join(__dirname, 'fixtures', 'scripts', 'nconf-hierarchical-defaults-merge.js'), |
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 9 instances in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
157080
3320
38