Socket
Socket
Sign inDemoInstall

convict

Package Overview
Dependencies
Maintainers
9
Versions
63
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

convict - npm Package Compare versions

Comparing version 2.0.0 to 3.0.0

422

CHANGELOG.md

@@ -1,275 +0,259 @@

2.0.0 / 2016-12-18
==================
# Change Log
* Named Pipe Support #175 (Gurpreet Atwal @gurpreetatwal)
* Stop supporting Node.js 0.12 by december 2016 #166 (Marc-Aurèle Darche @madarche)
* Stop supporting Node.js 0.10 by october 2016 #164 (Marc-Aurèle Darche @madarche)
* Remove deprecated methods `root` and `toSchemaString`
* Deps: validator@6.2.0
* Deps: moment@2.17.1
* Deps: json5@0.5.1
* devDeps: all up-to-date
All notable changes to this project will be documented in this file.
1.5.0 / 2016-09-28
==================
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).
* Add `RegExp` format #165 (@philbooth)
## [3.0.0] - 2017-03-16
### Added
1.4.0 / 2016-05-29
==================
- In `validate` function alter option `strict` to `allowed`, with option values `strict` and `warn` #182 (@benTrust)
* Add new reset method #148 (Marc-Aurèle Darche @madarche)
* Replace optimist which is deprecated #154 (Brian Vanderbusch @LongLiveCHIEF)
* Move varify to optionalDependencies #153 (@mlucool)
### Changed
1.3.0 / 2016-04-07
==================
- Rename pipe formats to emphasize that they are for windows pipes #179
(Gurpreet Atwal @gurpreetatwal)
- Update dependencies #184 (Marc-Aurèle Darche @madarche)
* Replace cjson with json5 (@ratson)
* Fix missing npm-shrinkwrap.json file in published NPM module
## [2.0.0] - 2016-12-18
1.2.0 / 2016-04-01
==================
- Named Pipe Support #175 (Gurpreet Atwal @gurpreetatwal)
- Stop supporting Node.js 0.12 by december 2016 #166 (Marc-Aurèle Darche @madarche)
- Stop supporting Node.js 0.10 by october 2016 #164 (Marc-Aurèle Darche @madarche)
- Remove deprecated methods `root` and `toSchemaString`
- Deps: validator@6.2.0
- Deps: moment@2.17.1
- Deps: json5@0.5.1
- devDeps: all up-to-date
* Support for built-in formats in schema files #138 (Hem Brahmbhatt @damnhipster)
* Improve stability and security: Use shrinkwrap to lock module dependencies #139 (Marc-Aurèle Darche @madarche)
* devDeps: coveralls@2.11.9 to stay in sync
* devDeps: eslint@2.5.3 to stay in sync
## [1.5.0] - 2016-09-28
1.1.3 / 2016-03-18
==================
- Add `RegExp` format #165 (@philbooth)
* Fix Null default with custom validator causes json parse error #122 (@RoboPhred)
* Documentation improvement (Brian Vanderbusch @LongLiveCHIEF)
* Deps: moment@2.12.0 to stay in sync
* devDeps: coveralls@2.11.8 to stay in sync
* devDeps: eslint@2.4.0 to stay in sync
* devDeps: mocha-lcov-reporter@1.2.0 to stay in sync
## [1.4.0] - 2016-05-29
1.1.2 / 2016-02-12
==================
- Add new reset method #148 (Marc-Aurèle Darche @madarche)
- Replace optimist which is deprecated #154 (Brian Vanderbusch @LongLiveCHIEF)
- Move varify to optionalDependencies #153 (@mlucool)
* Documentation and management script fixes; no code changes.
## [1.3.0] - 2016-04-07
1.1.1 / 2016-02-05
==================
- Replace cjson with json5 (@ratson)
- Fix missing npm-shrinkwrap.json file in published NPM module
* Deps: moment@2.11.2 to fix
https://nodesecurity.io/advisories/moment_regular-expression-denial-of-service
* Deps: validator@4.6.1 to stay in sync
## [1.2.0] - 2016-04-01
1.1.0 / 2016-02-02
==================
- Support for built-in formats in schema files #138 (Hem Brahmbhatt @damnhipster)
- Improve stability and security: Use shrinkwrap to lock module dependencies #139 (Marc-Aurèle Darche @madarche)
- devDeps: coveralls@2.11.9 to stay in sync
- devDeps: eslint@2.5.3 to stay in sync
* Fix loading consecutive files could cause an error to be thrown #111
(Abdullah Ali @voodooattack)
* Coerce values loaded from a file #96 (Jens Olsson @jsol)
* Improvement: Pass instance to coerce #109 (Abdullah Ali @voodooattack)
* Fix missing return in validate reducer #101 (Kris Reeves @myndzi)
* Deps: moment
* Deps: validator
* Switch back from Blanket to Istanbul for test coverage (Marc-Aurèle Darche @madarche)
* Stricter JSLint linting (Marc-Aurèle Darche @madarche)
* Improve documentation (Olivier Lalonde @olalonde, Marc-Aurèle Darche @madarche)
## [1.1.3] - 2016-03-18
1.0.2 / 2015-12-09
==================
- Fix Null default with custom validator causes json parse error #122 (@RoboPhred)
- Documentation improvement (Brian Vanderbusch @LongLiveCHIEF)
- Deps: moment@2.12.0 to stay in sync
- devDeps: coveralls@2.11.8 to stay in sync
- devDeps: eslint@2.4.0 to stay in sync
- devDeps: mocha-lcov-reporter@1.2.0 to stay in sync
* Merge pull request [#97](https://github.com/mozilla/node-convict/issues/97) from yoz/cjson-0.3.2
Update cjson dependency to 0.3.2
* Update cjson dependency to 0.3.2
This removes the transitive dependency on 'jsonlint' (in favor of json-parse-helpfulerror), which avoids its problems with unstated depdendencies on 'file' and 'system'.
* Coerce values loaded from a file
Previously values were coerced if added through
set(), command line arguments or env arguments.
Added the schema to the recursive overlay function
so that values added through load() and loadFile()
are also coerced.
Corrected a test to reflect this.
* Deps: update all
* Switch from JSHint to ESLint
## [1.1.2] - 2016-02-12
1.0.1 / 2015-08-11
==================
- Documentation and management script fixes; no code changes.
* Merge pull request [#87](https://github.com/mozilla/node-convict/issues/87) from mozilla/rfk/duration-integer-string
Accept integer millisecond durations in string form, e.g. from env vars.
* Accept integer millisecond durations in string form, e.g. from env vars.
## [1.1.1] - 2016-02-05
1.0.0 / 2015-08-01
==================
- Deps: moment@2.11.2 to fix
https://nodesecurity.io/advisories/moment_regular-expression-denial-of-service
- Deps: validator@4.6.1 to stay in sync
* Merge pull request [#85](https://github.com/mozilla/node-convict/issues/85) from madarche/feat-1.0
v1.0.0 and remove old deprecated formats ipv4 and ipv6
* Better wording for validate options
* Consistency using periods
* Improve feature description again
* Improved features description
* Better config.validate([options]) doc + beautify
* Update dependencies
* Merge branch 'feat-update-dependencies' into feat-1.0
* v1.0.0 Remove old deprecated formats ipv4 and ipv6
* 0.8.2
## [1.1.0] - 2016-02-02
0.8.2 / 2015-07-20
==================
- Fix loading consecutive files could cause an error to be thrown #111
(Abdullah Ali @voodooattack)
- Coerce values loaded from a file #96 (Jens Olsson @jsol)
- Improvement: Pass instance to coerce #109 (Abdullah Ali @voodooattack)
- Fix missing return in validate reducer #101 (Kris Reeves @myndzi)
- Deps: moment
- Deps: validator
- Switch back from Blanket to Istanbul for test coverage (Marc-Aurèle Darche @madarche)
- Stricter JSLint linting (Marc-Aurèle Darche @madarche)
- Improve documentation (Olivier Lalonde @olalonde, Marc-Aurèle Darche @madarche)
* Merge pull request [#84](https://github.com/mozilla/node-convict/issues/84) from madarche/feat-update-deps
Update dependencies
* Update dependencies
## [1.0.2] - 2015-12-09
0.8.1 / 2015-07-20
==================
- Merge pull request [#97](https://github.com/mozilla/node-convict/issues/97) from yoz/cjson-0.3.2
Update cjson dependency to 0.3.2
- Update cjson dependency to 0.3.2
This removes the transitive dependency on 'jsonlint' (in favor of json-parse-helpfulerror), which avoids its problems with unstated depdendencies on 'file' and 'system'.
- Coerce values loaded from a file
Previously values were coerced if added through
set(), command line arguments or env arguments.
Added the schema to the recursive overlay function
so that values added through load() and loadFile()
are also coerced.
Corrected a test to reflect this.
- Deps: update all
- Switch from JSHint to ESLint
* 0.8.1
* Merge pull request [#82](https://github.com/mozilla/node-convict/issues/82) from myndzi/fix-license
Update package.json 'license' key format
* Merge pull request [#83](https://github.com/mozilla/node-convict/issues/83) from madarche/feat-get-properties
Document and test properties and schema export
* Document and test properties and schema export
This modification also renames the previously undocumented and untested
following methods:
* root→getProperties and
* toSchemaString→getSchemaString
The renaming was done for clearer intent and consistency in naming. The
previous method names are still supported but deprecated.
* Update package.json 'license' key format
* Merge pull request [#80](https://github.com/mozilla/node-convict/issues/80) from madarche/fix-nested-schema-doc
Document nested settings in schema
* Merge pull request [#79](https://github.com/mozilla/node-convict/issues/79) from madarche/fix-doc
Document new strict validation mode
* Document nested settings in schema
Fixes [#78](https://github.com/mozilla/node-convict/issues/78)
* Document new strict validation mode
Fixes [#75](https://github.com/mozilla/node-convict/issues/75)
* Merge pull request [#77](https://github.com/mozilla/node-convict/issues/77) from madarche/fix-test_coverage
Fix test coverage
* Fix test coverage
The rationale in this change is to put logic as less as possible in
.travis.yml since it's not testable on developers' system.
* Merge pull request [#76](https://github.com/mozilla/node-convict/issues/76) from madarche/feat-update_dependencies
Update dependencies
* Merge pull request [#74](https://github.com/mozilla/node-convict/issues/74) from mmerkes/master
Fixes [#73](https://github.com/mozilla/node-convict/issues/73), removes validator.check from README.md and adds valid form…
* Update dependencies
* Adds convict.addFormat() to validation section of README and tidies up section
* Fixes [#73](https://github.com/mozilla/node-convict/issues/73), removes validator.check from README.md and adds valid format checker
## [1.0.1] - 2015-08-11
0.8.0 / 2015-05-31
==================
- Merge pull request [#87](https://github.com/mozilla/node-convict/issues/87) from mozilla/rfk/duration-integer-string
Accept integer millisecond durations in string form, e.g. from env vars.
- Accept integer millisecond durations in string form, e.g. from env vars.
* Merge pull request [#64](https://github.com/mozilla/node-convict/issues/64) from umar-muneer/master
Strict Validation Mode Added
* Merge pull request [#72](https://github.com/mozilla/node-convict/issues/72) from pdehaan/patch-2
Fix typos in README
* Fix typos in README
## [1.0.0] - 2015-08-01
0.7.0 / 2015-04-29
==================
- Merge pull request [#85](https://github.com/mozilla/node-convict/issues/85) from madarche/feat-1.0
v1.0.0 and remove old deprecated formats ipv4 and ipv6
- Better wording for validate options
- Consistency using periods
- Improve feature description again
- Improved features description
- Better config.validate([options]) doc + beautify
- Update dependencies
- Merge branch 'feat-update-dependencies' into feat-1.0
- v1.0.0 Remove old deprecated formats ipv4 and ipv6
* Merge pull request [#66](https://github.com/mozilla/node-convict/issues/66) from collinwat/add-format-overload
addFormat supports object arguments as well as function arguments
* Merge pull request [#70](https://github.com/mozilla/node-convict/issues/70) from madarche/fix-update-deps
Update dependencies and removed `should` replaced
* Merge pull request [#69](https://github.com/mozilla/node-convict/issues/69) from madarche/feat-new-nodejs-0.12
Make CI test Node.js 0.12, the new stable
* Update dependencies and removed `should` replaced
`should` has been replaced by `js-must`.
* Make CI test Node.js 0.12, the new stable
* Merge pull request [#61](https://github.com/mozilla/node-convict/issues/61) from ronjouch/browserifyTransformVarify
Add 'varify' browserify transform to support IE9,10
* Add format supports object arguments as well as function arguments
* Merge pull request [#62](https://github.com/mozilla/node-convict/issues/62) from madjid04/master
Add code coverage with blanket
* Strict Validation Mode
1. Added a fix for nested validation checks.
2. Modified test case schema and config files.
* Strict Validation Mode Added
1. Added a Strict Validation mode. If set to true, any properties
specified in config files that are not declared in the schema will
result in errors. This is to ensure that the schema and the config
files are in sync. This brings convict further in line with the concept
of a “Schema”. By default the strict mode is set to false.
2. Added test cases for strict mode
* modification of the indentation
## [0.8.2] - 2015-07-20
0.6.1 / 2015-01-12
==================
- Merge pull request [#84](https://github.com/mozilla/node-convict/issues/84) from madarche/feat-update-deps
Update dependencies
- Update dependencies
* Fix duration check #54
* Update dependencies #48
* Use js-must a safer test assertion library #49
## [0.8.1] - 2015-07-20
0.6.0 / 2014-11-14
==================
- Merge pull request [#82](https://github.com/mozilla/node-convict/issues/82) from myndzi/fix-license
Update package.json 'license' key format
- Merge pull request [#83](https://github.com/mozilla/node-convict/issues/83) from madarche/feat-get-properties
Document and test properties and schema export
- Document and test properties and schema export
This modification also renames the previously undocumented and untested
following methods:
* root→getProperties and
* toSchemaString→getSchemaString
The renaming was done for clearer intent and consistency in naming. The
previous method names are still supported but deprecated.
- Update package.json 'license' key format
- Merge pull request [#80](https://github.com/mozilla/node-convict/issues/80) from madarche/fix-nested-schema-doc
Document nested settings in schema
- Merge pull request [#79](https://github.com/mozilla/node-convict/issues/79) from madarche/fix-doc
Document new strict validation mode
- Document nested settings in schema
Fixes [#78](https://github.com/mozilla/node-convict/issues/78)
- Document new strict validation mode
Fixes [#75](https://github.com/mozilla/node-convict/issues/75)
- Merge pull request [#77](https://github.com/mozilla/node-convict/issues/77) from madarche/fix-test_coverage
Fix test coverage
- Fix test coverage
The rationale in this change is to put logic as less as possible in
.travis.yml since it's not testable on developers' system.
- Merge pull request [#76](https://github.com/mozilla/node-convict/issues/76) from madarche/feat-update_dependencies
Update dependencies
- Merge pull request [#74](https://github.com/mozilla/node-convict/issues/74) from mmerkes/master
Fixes [#73](https://github.com/mozilla/node-convict/issues/73), removes validator.check from README.md and adds valid form…
- Update dependencies
- Adds convict.addFormat() to validation section of README and tidies up section
- Fixes [#73](https://github.com/mozilla/node-convict/issues/73), removes validator.check from README.md and adds valid format checker
* Update dependencies (including latest validator) #46
* Deprecate "ipv4" and "ipv6" formats
## [0.8.0] - 2015-05-31
0.5.1 / 2014-10-29
==================
- Merge pull request [#64](https://github.com/mozilla/node-convict/issues/64) from umar-muneer/master
Strict Validation Mode Added
- Merge pull request [#72](https://github.com/mozilla/node-convict/issues/72) from pdehaan/patch-2
Fix typos in README
- Fix typos in README
* Update dependencies
* Use fix versions everywhere for safe validation
* More readable date for test #43
## [0.7.0] - 2015-04-29
0.5.0 / 2014-10-15
==================
* Fix npmignore anything that's not needed for production #38
* Fix The schema get modified by convict #37
* npm ignore things
* JSHint lint + 80 cols formatting #39
- Merge pull request [#66](https://github.com/mozilla/node-convict/issues/66) from collinwat/add-format-overload
addFormat supports object arguments as well as function arguments
- Merge pull request [#70](https://github.com/mozilla/node-convict/issues/70) from madarche/fix-update-deps
Update dependencies and removed `should` replaced
- Merge pull request [#69](https://github.com/mozilla/node-convict/issues/69) from madarche/feat-new-nodejs-0.12
Make CI test Node.js 0.12, the new stable
- Update dependencies and removed `should` replaced
`should` has been replaced by `js-must`.
- Make CI test Node.js 0.12, the new stable
- Merge pull request [#61](https://github.com/mozilla/node-convict/issues/61) from ronjouch/browserifyTransformVarify
Add 'varify' browserify transform to support IE9,10
- Add format supports object arguments as well as function arguments
- Merge pull request [#62](https://github.com/mozilla/node-convict/issues/62) from madjid04/master
Add code coverage with blanket
- Strict Validation Mode
1. Added a fix for nested validation checks.
2. Modified test case schema and config files.
- Strict Validation Mode Added
1. Added a Strict Validation mode. If set to true, any properties
specified in config files that are not declared in the schema will
result in errors. This is to ensure that the schema and the config
files are in sync. This brings convict further in line with the concept
of a “Schema”. By default the strict mode is set to false.
2. Added test cases for strict mode
- modification of the indentation
0.4.3 / 2014-10-13
==================
## [0.6.1] - 2015-01-12
* Test the correct convict object for the undefined attribute #31
* Update moment.js to 2.6.0 #36
- Fix duration check #54
- Update dependencies #48
- Use js-must a safer test assertion library #49
0.4.2 / 2014-01-12
==================
## [0.6.0] - 2014-11-14
* Update cjson 0.2.1 —> 0.3.0
* Coerce 'nat' formatted values #26
* Updat canonical package.json URLs #24
* Fix 'should handle timestamp' failing test #21
* Update package.json #43
* Add license info
- Update dependencies (including latest validator) #46
- Deprecate "ipv4" and "ipv6" formats
## [0.5.1] - 2014-10-29
- Update dependencies
- Use fix versions everywhere for safe validation
- More readable date for test #43
## [0.5.0] - 2014-10-15
- Fix npmignore anything that's not needed for production #38
- Fix The schema get modified by convict #37
- npm ignore things
- JSHint lint + 80 cols formatting #39
## [0.4.3] - 2014-10-13
- Test the correct convict object for the undefined attribute #31
- Update moment.js to 2.6.0 #36
## [0.4.2] - 2014-01-12
- Update cjson 0.2.1 —> 0.3.0
- Coerce 'nat' formatted values #26
- Updat canonical package.json URLs #24
- Fix 'should handle timestamp' failing test #21
- Update package.json #43
- Add license info
* Update Dependency #18
0.4.1 / 2013-10-14
==================
## [0.4.1] - 2013-10-14
* Support JSON formatted objects in env
- Support JSON formatted objects in env
0.4.0 / 2013-07-31
==================
## [0.4.0] - 2013-07-31
0.3.3 / 2013-06-18
==================
## [0.3.3] - 2013-06-18
0.3.1 / 2013-06-04
==================
## [0.3.1] - 2013-06-04
0.3.0 / 2013-06-03
==================
## [0.3.0] - 2013-06-03
0.2.3 / 2013-05-27
==================
## [0.2.3] - 2013-05-27
0.2.2 / 2013-05-25
==================
## [0.2.2] - 2013-05-25
0.2.1 / 2013-05-25
==================
## [0.2.1] - 2013-05-25
0.2.0 / 2013-05-23
==================
## [0.2.0] - 2013-05-23
0.1.1 / 2013-05-19
===================
## [0.1.1] - 2013-05-19
0.1.0 / 2013-03-05
==================
## [0.1.0] - 2013-03-05
* Initial release
Initial release

@@ -14,2 +14,3 @@ /**

const cloneDeep = require('lodash.clonedeep');
const deprecate = require('depd')('node-convict')

@@ -39,3 +40,3 @@ function assert(assertion, err_msg) {

/**
* Checks if x is a named pipe
* Checks if x is a windows named pipe
*

@@ -46,3 +47,3 @@ * @see https://msdn.microsoft.com/en-us/library/windows/desktop/aa365783(v=vs.85).aspx

*/
function isNamedPipe(x) {
function isWindowsNamedPipe(x) {
return String(x).includes('\\\\.\\pipe\\');

@@ -62,8 +63,8 @@ }

},
named_pipe: function(x) {
assert(isNamedPipe(x), 'must be a valid pipe');
windows_named_pipe: function(x) {
assert(isWindowsNamedPipe(x), 'must be a valid pipe');
},
named_pipe_or_port: function(x) {
if (!isNamedPipe(x)) {
assert(isPort(x), 'must be a pipe or a number within range 0 - 65535');
port_or_windows_named_pipe: function(x) {
if (!isWindowsNamedPipe(x)) {
assert(isPort(x), 'must be a windows named pipe or a number within range 0 - 65535');
}

@@ -97,7 +98,16 @@ },

const ALLOWED_OPTION_STRICT = 'strict';
const ALLOWED_OPTION_WARN = 'warn';
function validate(instance, schema, errors,strictValidation) {
if(!('params_not_declared' in errors)){
errors.params_not_declared = [];
}
if(!('values_not_good_type' in errors)){
errors.values_not_good_type = [];
}
Object.keys(instance).reduce(function(previousErrors, name) {
let p = schema.properties[name];
if (strictValidation && !p){
previousErrors.push(new Error("configuration param '"+name+"' not declared in the schema"));
previousErrors.params_not_declared.push(new Error("configuration param '"+name+"' not declared in the schema"));
return previousErrors;

@@ -115,3 +125,3 @@ }

} catch (e) {
previousErrors.push(e);
previousErrors.values_not_good_type.push(e);
}

@@ -330,3 +340,3 @@ }

case 'int': v = parseInt(v, 10); break;
case 'named_pipe_or_port': v = isNamedPipe(v) ? v : parseInt(v, 10); break;
case 'port_or_windows_named_pipe': v = isWindowsNamedPipe(v) ? v : parseInt(v, 10); break;
case 'number': v = parseFloat(v); break;

@@ -511,23 +521,49 @@ case 'boolean': v = ((v === 'false') ? false : true); break;

options = options || {};
options.strict = options.strict || false;
let errors = validate(this._instance, this._schema, [],options.strict);
if (errors.length) {
let errBuf = '';
if ('strict' in options) {
if(options.strict){
options.allowed = ALLOWED_OPTION_STRICT
deprecate('this syntax is outdated: validate({strict: true}), you must use: validate({allowed: \'' + ALLOWED_OPTION_STRICT + '\'})')
}else{
deprecate('this syntax is outdated: validate({strict: false}), you must just use: validate()')
}
}
for (let i = 0; i < errors.length; i++) {
options.allowed = options.allowed || ALLOWED_OPTION_WARN;
let errors = validate(this._instance, this._schema, [], options.allowed);
if (errBuf.length) errBuf += '\n';
if (errors.values_not_good_type.length + errors.params_not_declared.length) {
let e = errors[i];
let fillErrorBuffer = function(errors) {
let err_buf = '';
for (let i = 0; i < errors.length; i++) {
if (e.fullName) {
errBuf += e.fullName + ': ';
if (err_buf.length) err_buf += '\n';
let e = errors[i];
if (e.fullName) {
err_buf += e.fullName + ': ';
}
if (e.message) err_buf += e.message;
if (e.value) {
err_buf += ': value was ' + JSON.stringify(e.value);
}
}
if (e.message) errBuf += e.message;
if (e.value) {
errBuf += ': value was ' + JSON.stringify(e.value);
}
return err_buf;
};
let types_err_buf = fillErrorBuffer(errors.values_not_good_type);
let params_err_buf = fillErrorBuffer(errors.params_not_declared);
if (options.allowed === ALLOWED_OPTION_WARN && params_err_buf.length) {
global.console.log('Warning: '+ params_err_buf);
} else if (options.allowed === ALLOWED_OPTION_STRICT) {
types_err_buf += types_err_buf.length && params_err_buf.length ? '\n' + params_err_buf : params_err_buf;
}
throw new Error(errBuf);
if(types_err_buf.length) {
throw new Error(types_err_buf);
}
}

@@ -534,0 +570,0 @@ return this;

{
"name": "convict",
"version": "2.0.0",
"version": "3.0.0",
"dependencies": {
"depd": {
"version": "1.1.0",
"from": "depd@1.1.0",
"resolved": "https://registry.npmjs.org/depd/-/depd-1.1.0.tgz"
},
"json5": {

@@ -26,27 +31,27 @@ "version": "0.5.1",

"validator": {
"version": "6.2.0",
"from": "validator@6.2.0",
"resolved": "https://registry.npmjs.org/validator/-/validator-6.2.0.tgz"
"version": "7.0.0",
"from": "validator@7.0.0",
"resolved": "https://registry.npmjs.org/validator/-/validator-7.0.0.tgz"
},
"varify": {
"version": "0.1.1",
"from": "varify@0.1.1",
"resolved": "https://registry.npmjs.org/varify/-/varify-0.1.1.tgz",
"version": "0.2.0",
"from": "varify@0.2.0",
"resolved": "https://registry.npmjs.org/varify/-/varify-0.2.0.tgz",
"dependencies": {
"through": {
"version": "2.3.8",
"from": "through@>=2.3.4 <2.4.0",
"resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz"
},
"redeyed": {
"version": "0.4.4",
"from": "redeyed@>=0.4.2 <0.5.0",
"resolved": "https://registry.npmjs.org/redeyed/-/redeyed-0.4.4.tgz",
"version": "1.0.1",
"from": "redeyed@>=1.0.1 <1.1.0",
"resolved": "https://registry.npmjs.org/redeyed/-/redeyed-1.0.1.tgz",
"dependencies": {
"esprima": {
"version": "1.0.4",
"from": "esprima@>=1.0.4 <1.1.0",
"resolved": "https://registry.npmjs.org/esprima/-/esprima-1.0.4.tgz"
"version": "3.0.0",
"from": "esprima@>=3.0.0 <3.1.0",
"resolved": "https://registry.npmjs.org/esprima/-/esprima-3.0.0.tgz"
}
}
},
"through": {
"version": "2.3.8",
"from": "through@>=2.3.4 <2.4.0",
"resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz"
}

@@ -53,0 +58,0 @@ }

@@ -13,3 +13,3 @@ {

],
"version": "2.0.0",
"version": "3.0.0",
"license": "Apache-2.0",

@@ -45,2 +45,3 @@ "homepage": "https://github.com/mozilla/node-convict",

"dependencies": {
"depd": "1.1.0",
"json5": "0.5.1",

@@ -50,11 +51,11 @@ "lodash.clonedeep": "4.5.0",

"moment": "2.17.1",
"validator": "6.2.0"
"validator": "7.0.0"
},
"devDependencies": {
"coveralls": "2.11.15",
"eslint": "3.12.2",
"coveralls": "2.12.0",
"eslint": "3.17.1",
"istanbul": "0.4.5",
"mocha": "3.2.0",
"mocha-lcov-reporter": "1.2.0",
"must": "0.13.2",
"mocha-lcov-reporter": "1.3.0",
"must": "0.13.4",
"obj_diff": "0.3.0"

@@ -68,4 +69,4 @@ },

"optionalDependencies": {
"varify": "0.1.1"
"varify": "0.2.0"
}
}

@@ -68,3 +68,3 @@ # Node-convict

// Perform validation
conf.validate({strict: true});
conf.validate({allowed: 'strict'});

@@ -160,2 +160,26 @@ module.exports = conf;

Deep nested example:
```javascript
conf = convict({
db: {
name: {
format: String,
default: ''
},
synchro: {
active: {
format: 'Boolean',
default: false
},
remote_url: {
format: 'url',
default: 'http://localhost:8080/'
}
}
}
});
```
Note: Search for the word "nested" throughout this documentation to find out

@@ -173,4 +197,4 @@ more about nested configuration settings.

* `port`
* `named_pipe`
* `named_pipe_or_port`
* `windows_named_pipe`
* `port_or_windows_named_pipe`
* `url`

@@ -334,11 +358,15 @@ * `email`

Validates `config` against the schema used to initialize it. All errors are
collected and thrown at once.
collected and thrown or displayed at once.
Options: At the moment `strict` is the only available option.
#### allowed option
If the `strict` option is passed (that is `{strict: true}` is passed), any
properties specified in config files that are not declared in the schema will
result in errors. This is to ensure that the schema and the config files are in
sync. By default the strict mode is set to false.
1. `warn`: If set to `warn` (that is `{allowed: 'warn'}` is passed), any
properties specified in config files that are not declared in the schema will
print a warning. This is the default behavior.
2. `strict`: If set to `strict` (that is `{allowed: 'strict'}` is passed), any
properties specified in config files that are not declared in the schema will
throw errors. This is to ensure that the schema and the config files are in
sync.
### config.getProperties()

@@ -345,0 +373,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc