Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

config-ninja

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

config-ninja - npm Package Compare versions

Comparing version 0.2.0 to 0.2.1

2

package.json

@@ -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

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