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

configist

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

configist

Easy deployment configuration.

  • 0.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

Easy deployment configuration

With configist you get the possibility to configure your application in various ways (in precedence order):

  • config in package.json
  • config:{environment} in package.json
  • environment variables
  • command line arguments
  • custom objects

Let's say the configuration is like this:

// package.json
{
  "config": {
    "listen": "127.0.0.1:5000"
  },
  "config:development": {
    "db": "mongodb://localhost"
  },
  "config:production": {
    "listen": "0.0.0.0:80",
    "db": "mongodb://db1.example.net:2500"
  }
}

Basic usage:

var config = require('configist')().use(require('./package.json'));

console.log(config);

Output when NODE_ENV=development (or not given):

{ listen: '127.0.0.1:5000',
  db: 'mongodb://localhost',
  env: 'development' }

Output when NODE_ENV=production:

{ listen: '0.0.0.0:80',
  db: 'mongodb://db1.example.net:2500',
  env: 'production' }

You can change the configuration dynamically. The commands are all equivalent and sets the listen parameter:

node . --listen=:3000
npm start --listen=:3000
LISTEN=:3000 node .
LISTEN=:3000 npm start

You can load multiple configurations:

var configist = require('configist')();

configist.use(null, {
  base_url: 'http://example.com'
});
configist.use(require('./package.json'));
configist.use(require('./client-side/package.json'));
configist.use('development', {
  shared_secret: 'sg4lWb15Lt7OZYR/yyly3S1HrVou1xMN'
});

console.log(configist);

Happy hacking!

By the way, you can install it:

npm install configist

FAQs

Package last updated on 02 Oct 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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