config-ninja
Advanced tools
Comparing version 0.2.0 to 0.2.1
@@ -13,3 +13,3 @@ { | ||
"name": "config-ninja", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "Environmental JSON config.", | ||
@@ -16,0 +16,0 @@ "keywords": [ |
@@ -6,6 +6,6 @@ # Config-Ninja | ||
**Important:** The `production` config is always the default config. If you specify another environment, Config Ninja will copy the properties from that environment into the production config, overwriting any values that already exist. Nested properties will be respected. No changes are saved to disk. | ||
**Important:** The `production` config is always the default config. If you specify another environment such as `staging` or `development`, Config Ninja will deep merge the properties from that environment into the production config, overwriting any values that already exist. You can nest properties as deeply as you like. No changes are persisted to disk. | ||
## Quick Start | ||
Create a directory to hold your config files and create a `production.config.json` file which will contain all your configuration. Then create a `development.config.json` file which will hold config _specific_ to your development environment. Then in your `index.js`: | ||
Create a directory to hold your config files and create a `production.config.json` file which will contain all your configuration. Then create a `development.config.json` file which will hold only the _specific_ values that need to be different in your development environment. Then in your application entry point, e.g. `index.js`: | ||
@@ -15,7 +15,10 @@ ```javascript | ||
const config = require('config-ninja').init('/path/to/cfg/dir/'); | ||
``` | ||
// In another module we need config again... | ||
To load the config in other modules: | ||
```javascript | ||
// Load in the config again, taking advantage of Node's module caching. | ||
const config = require('config-ninja'); | ||
// Use our config. | ||
// Use the config! | ||
console.dir(config); | ||
@@ -25,3 +28,3 @@ console.log('Nested Number:', config.nested.number); // See examples. | ||
See `example.js` for a working example. | ||
See `example.js` for a working example which you can run with `node ./examples/example`. | ||
@@ -28,0 +31,0 @@ ## Setup Config Files |
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
17193
126