Socket
Socket
Sign inDemoInstall

envious

Package Overview
Dependencies
0
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    envious

making environment configuration dead easy


Version published
Weekly downloads
3
increased by50%
Maintainers
1
Install size
19.0 kB
Created
Weekly downloads
 

Readme

Source

envious: environment variables made easy, fun, and finally profitable

envious makes it absurdly easy for you to configure your environment, so you can have a central place to define credentials and whatnot.

install

npm install envious

textbook example

put this in your pipe

var envious = require('envious');

envious.development = 
{
  "mongodb_hostname": "dev.local",
  "site_url": "http://127.0.0.1/",
}

envious.production = 
{
  "mongodb_hostname": "masterdb.sterlingcooper.com",
  "site_url": "http://zombo.com/",
}

envious.default_env = "development";

var env = envious.apply();

console.log(env.site_url);

and smoke it

NODE_ENV=production node app.js

options

strict: strict environment checking

var env = envious.apply({strict: true});

When strict is on, it will throw an error if the environment does not exist. normally, it would simply fall back to the default.

strictProperties: if the current environment is missing properties that the default environment has, throw an error.

var env = envious.apply({strictProperties: true});

By default, properties not defined in the current environment will be copied from the default environment.

tests

you have to run the tests a certain way.

  • normal.js: tests normal function. NODE_ENV=production node normal.js
  • default.js: tests the default environment feature. node default.js
  • strict.js: tests strict mode. NODE_ENV=bogus node strict.js

FAQs

Last updated on 26 Dec 2011

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc