New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

configgit

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

configgit

The easiest way to wrangle your env-specific configuration in node

  • 1.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

configgit

A wrapper for grabbing env vars from either process.env or a config file depending on the NODE_ENV.

Heavily (totally) influenced and inspired by a pattern that @tautologistics implemented at Moveline.

usage

config/{env}.json file structure

super-config expects a config/{env}.json convention, something like the following:

+--app
+--package.json
+--config
|  +--development.json
|  +--testing.json
|  +--production.json

Where development.json looks like:

//development.json
{
  "PORT": "3000",
  "JEDI_NAME": "Dinkus"
}

Set your NODE_ENV (configgit defaults to 'development'), and....

var Config = require('configgit')()

console.log(Config.get("JEDI_NAME")); // Dinkus

configgit expects a JSON file to exist at '/config/' + process.env.NODE_ENV.toLowerCase(). If one does not, you will see a message logged to the console telling you just that.

###process.env[key] overwrites config/{env}[key]

Any keys added to process.env will overwrite any matching keys in the config file.

Prefix the above example with a JEDI_NAME="Dorku", and run:

var Config = require('configgit')()

console.log(Config.get("JEDI_NAME")); // Dorku

Keywords

FAQs

Package last updated on 18 Feb 2015

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