Comparing version 0.8.2 to 1.0.0
@@ -46,8 +46,2 @@ /** | ||
}, | ||
ipv4: deprecate.function(function(x) { | ||
assert(validator.isIP(x), 'must be an IP address'); | ||
}, "There is no IPv4 vs IPv6 addresses checking anymore, use \"ipaddress\" instead."), | ||
ipv6: deprecate.function(function(x) { | ||
assert(validator.isIP(x), 'must be an IP address'); | ||
}, "There is no IPv4 vs IPv6 addresses checking anymore, use \"ipaddress\" instead."), | ||
duration: function(x) { | ||
@@ -54,0 +48,0 @@ var err_msg = 'must be a positive integer or human readable string (e.g. 3000, "5 days")'; |
@@ -5,3 +5,3 @@ { | ||
"description": "Unruly configuration management for nodejs", | ||
"version": "0.8.2", | ||
"version": "1.0.0", | ||
"homepage": "https://github.com/mozilla/node-convict", | ||
@@ -19,5 +19,5 @@ "repository": { | ||
"depd": "1.0.1", | ||
"moment": "2.10.3", | ||
"moment": "2.10.6", | ||
"optimist": "0.6.1", | ||
"validator": "3.40.0", | ||
"validator": "3.43.0", | ||
"varify": "0.1.1" | ||
@@ -27,3 +27,3 @@ }, | ||
"blanket": "1.1.7", | ||
"coveralls": "2.11.2", | ||
"coveralls": "2.11.3", | ||
"jshint": "2.8.0", | ||
@@ -30,0 +30,0 @@ "mocha": "2.2.5", |
@@ -12,7 +12,17 @@ # Node-convict | ||
## Features | ||
* **Loading and merging**: configurations are loaded from disk or inline and merged. JSON files are loaded with `cjson` so comments are welcome. | ||
* **Environmental variables**: values can be derived from environmental variables | ||
* **Command-line arguments**: values can also be derived from command-line arguments | ||
* **Validation**: configurations are validated against your schema, generating an error report with all errors that are found | ||
* **Loading and merging**: configurations are loaded from disk or inline and | ||
merged | ||
* **Nested structure**: keys and values can be organized in a tree structure | ||
* **Environmental variables**: values can be derived from environmental | ||
variables | ||
* **Command-line arguments**: values can also be derived from command-line | ||
arguments | ||
* **Validation**: configurations are validated against your schema (presence | ||
checking, type checking, custom checking), generating an error report with | ||
all errors that are found | ||
* **Comments allowed**: JSON files are loaded with the `cjson` module, so | ||
comments are welcome | ||
## Install | ||
@@ -25,3 +35,2 @@ ```bash | ||
An example `config.js`: | ||
@@ -31,4 +40,3 @@ ```javascript | ||
// define a schema | ||
// Define a schema | ||
var conf = convict({ | ||
@@ -55,12 +63,9 @@ env: { | ||
// load environment dependent configuration | ||
// Load environment dependent configuration | ||
var env = conf.get('env'); | ||
conf.loadFile('./config/' + env + '.json'); | ||
// perform validation | ||
// Perform validation | ||
conf.validate({strict: true}); | ||
conf.validate(); | ||
module.exports = conf; | ||
@@ -79,3 +84,3 @@ ``` | ||
// consume | ||
// Consume | ||
server.listen(conf.get('port'), conf.get('ip'), function(x) { | ||
@@ -208,2 +213,3 @@ var addy = server.address(); | ||
## API | ||
@@ -220,3 +226,2 @@ | ||
// or | ||
config.get('database').host; | ||
@@ -235,3 +240,3 @@ ``` | ||
if (config.has('some.property')) { | ||
// do something | ||
// Do something | ||
} | ||
@@ -245,3 +250,3 @@ ``` | ||
config.get('property.that.may.not.exist.yet'); | ||
// returns "some value" | ||
// Returns "some value" | ||
``` | ||
@@ -271,11 +276,14 @@ | ||
### config.validate([{strict: true}]) | ||
### config.validate([options]) | ||
Validates `config` against the schema used to initialize it. All errors are collected and thrown at once. | ||
Validates `config` against the schema used to initialize it. All errors are | ||
collected and thrown at once. | ||
If the `{strict: true}` option 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. | ||
Options: At the moment `strict` is the only available 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. | ||
### config.getProperties() | ||
@@ -298,4 +306,5 @@ | ||
## faq | ||
## FAQ | ||
### [How can I define a configuration property as "required" without providing a default value?](https://github.com/mozilla/node-convict/issues/29) | ||
@@ -302,0 +311,0 @@ |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
0
310
28872
415
+ Addedmoment@2.10.6(transitive)
+ Addedvalidator@3.43.0(transitive)
- Removedmoment@2.10.3(transitive)
- Removedvalidator@3.40.0(transitive)
Updatedmoment@2.10.6
Updatedvalidator@3.43.0