Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

modreal-config

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

modreal-config

This is an opinionated simple configuration package. It assumes:

latest
Source
npmnpm
Version
0.0.3
Version published
Maintainers
1
Created
Source

modreal-config

This is an opinionated simple configuration package. It assumes:

  • configuraiton is a config folder with json files
  • the name of the json file is the name of the configuration
  • NODE_ENV is used for the app environment
  • test defaults to development, staging defaults to production
  • if no environment is specified, it is for all environments

How To Use

Add to your package as a dependency:

"dependencies": {
  "modreal-config": "modreal/config"
}

Install it:

$ npm install

Require it:

// javascript
var config = require("modreal-config");
# coffeescript
config = require 'modreal-config'

Access your configuraiton:

console.log(config.facebook)

See the next section for where to put your config json.

Config Folder Location

The config folder must be in the same directory or a parent directory of your main script file. Here are some examples of working folder setups:

+ package.json
- config
+ main.js
+ package.json
- config
- lib
  + main.js
+ package.json
- lib
  - config
  + main.js

Example JSON Files

mongo.json

{
  "production": "mongodb://alweof8a:893fhalw8efla389fhaw9efgaw@82.154.4.14:1472/app_production",
  "staging": "mongodb://alweof8a:893fhalw8efla389fhaw9efgaw@82.154.4.14:1472/app_staging",
  "development": "mongodb://localhost:27017/app_development",
  "test": "mongodb://localhost:27017/app_test"
}

Would then be available at:

console.log(process.env.NODE_ENV)
// development

config = require('modreal-config')
console.log(config.mongo)
// mongodb://localhost:27017/app_development

License

MIT

AJ Ostrow, November 2013

FAQs

Package last updated on 06 Nov 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