Comparing version 4.0.0 to 4.0.1
@@ -8,2 +8,12 @@ # Change Log | ||
## [4.0.1] - 2017-09-17 | ||
### Changed | ||
- Update dependencies #220 (Marc-Aurèle Darche @madarche) | ||
- Move away from minimist to yargs-parser #219 (Marc-Aurèle Darche @madarche) | ||
- Corrected a typo #218 (Nikolay Govorov @nikolay-govorov) | ||
- Fix issue with empty string over default not null value #217 (Jonathan Petitcolas @jpetitcolas) | ||
- Ensure property defaults are not modified #216 (Eli Young @elyscape) | ||
- Nested props in 'object' values are not undeclared #215 (Michael McGahan @mmcgahan) | ||
## [4.0.0] - 2017-06-22 | ||
@@ -10,0 +20,0 @@ ### Added |
@@ -12,3 +12,3 @@ /** | ||
const moment = require('moment'); | ||
const minimist = require('minimist'); | ||
const parseArgs = require('yargs-parser'); | ||
const cloneDeep = require('lodash.clonedeep'); | ||
@@ -175,2 +175,12 @@ const deprecate = require('depd')('node-convict') | ||
// ignore nested keys of 'object' config params | ||
if (schemaItem.format === 'object') { | ||
Object.keys(flatInstance) | ||
.filter(function(key) { | ||
return key.lastIndexOf(name + '.', 0) === 0; | ||
}).forEach(function(key) { | ||
delete flatInstance[key]; | ||
}); | ||
} | ||
if (!(typeof schemaItem.default === 'undefined' && | ||
@@ -271,3 +281,3 @@ instanceItem === schemaItem.default)) { | ||
Object.prototype.toString.call(new Format()), | ||
'must be of type ' + Format.name); | ||
'must be of type ' + Format.name); | ||
}; | ||
@@ -317,3 +327,2 @@ o.format = Format.name.toLowerCase(); | ||
}; | ||
} | ||
@@ -323,3 +332,3 @@ | ||
Object.keys(o._env).forEach(function(envStr) { | ||
if (process.env[envStr]) { | ||
if (process.env[envStr] !== undefined) { | ||
let ks = o._env[envStr]; | ||
@@ -334,3 +343,3 @@ ks.forEach(function(k) { | ||
function importArguments(o) { | ||
let argv = minimist(process.argv.slice(2)); | ||
const argv = parseArgs(process.argv.slice(2)); | ||
Object.keys(o._argv).forEach(function(argStr) { | ||
@@ -352,3 +361,3 @@ let k = o._argv[argStr]; | ||
} else { | ||
c[name] = coerce(name, p.default, schema, instance); | ||
c[name] = coerce(name, cloneDeep(p.default), schema, instance); | ||
} | ||
@@ -355,0 +364,0 @@ }); |
{ | ||
"author": "Lloyd Hilaiel <lloyd@hilaiel.com> (http://lloyd.io)", | ||
"name": "convict", | ||
"description": "Unruly configuration management for Node.js", | ||
"description": "Featureful configuration management library for Node.js (nested structure, schema validation, etc.)", | ||
"keywords": [ | ||
@@ -13,3 +13,3 @@ "configuration", | ||
], | ||
"version": "4.0.0", | ||
"version": "4.0.1", | ||
"license": "Apache-2.0", | ||
@@ -44,15 +44,14 @@ "homepage": "https://github.com/mozilla/node-convict", | ||
"dependencies": { | ||
"depd": "1.1.0", | ||
"depd": "1.1.1", | ||
"json5": "0.5.1", | ||
"lodash.clonedeep": "4.5.0", | ||
"minimist": "1.2.0", | ||
"moment": "2.17.1", | ||
"validator": "7.0.0" | ||
"moment": "2.18.1", | ||
"validator": "7.2.0", | ||
"yargs-parser": "7.0.0" | ||
}, | ||
"devDependencies": { | ||
"coveralls": "2.12.0", | ||
"eslint": "3.17.1", | ||
"coveralls": "2.13.1", | ||
"eslint": "4.6.1", | ||
"istanbul": "0.4.5", | ||
"mocha": "3.2.0", | ||
"mocha-lcov-reporter": "1.3.0", | ||
"mocha": "3.5.3", | ||
"must": "0.13.4", | ||
@@ -59,0 +58,0 @@ "obj_diff": "0.3.0" |
@@ -45,3 +45,3 @@ # Node-convict | ||
env: { | ||
doc: "The applicaton environment.", | ||
doc: "The application environment.", | ||
format: ["production", "development", "test"], | ||
@@ -63,3 +63,3 @@ default: "development", | ||
}, | ||
database: { | ||
db: { | ||
host: { | ||
@@ -288,6 +288,6 @@ doc: "Database host name/IP", | ||
```javascript | ||
config.get('database.host'); | ||
config.get('db.host'); | ||
// or | ||
config.get('database').host; | ||
config.get('db').host; | ||
``` | ||
@@ -321,3 +321,3 @@ | ||
Sets the value of `name` to value. `name` can use dot notation to reference | ||
nested values, e.g. `"database.port"`. If objects in the chain don't yet exist, | ||
nested values, e.g. `"db.port"`. If objects in the chain don't yet exist, | ||
they will be initialized to empty objects. | ||
@@ -324,0 +324,0 @@ E.g.: |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
46905
6
627
+ Addedyargs-parser@7.0.0
+ Addedcamelcase@4.1.0(transitive)
+ Addeddepd@1.1.1(transitive)
+ Addedmoment@2.18.1(transitive)
+ Addedvalidator@7.2.0(transitive)
+ Addedyargs-parser@7.0.0(transitive)
- Removedminimist@1.2.0
- Removeddepd@1.1.0(transitive)
- Removedminimist@1.2.0(transitive)
- Removedmoment@2.17.1(transitive)
- Removedvalidator@7.0.0(transitive)
Updateddepd@1.1.1
Updatedmoment@2.18.1
Updatedvalidator@7.2.0