Socket
Book a DemoInstallSign in
Socket

beat-conf

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

beat-conf

Simple configuration utility for Beat dependency injection

0.0.2
latest
Source
npmnpm
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

beat-conf Build Status Code Climate

Simple configuration utility for Beat dependency injection

NPM

This module provide a conf object to be injected in beat instances.

How to use

Set your configurations normally in the native package.json (abbreviated here for simplicity)

{
  ...
  "config": {
    "serverPort": "3000",
    "mongo": "mongodb://localhost:27017/production_db",
    "publicPath": "/public"
  }
}

Install this module with NPM:

npm install --save beat-conf

Declare it as a dependency of your Beat module and inject conf object where you need it

var Beat = require('beat');
var server = module.exports = new Beat('server', [
  'beat-conf',
  'http'
]);

server.run(function(http, conf){
  http.createServer().listen(conf.serverPort);
});

Config environments

This utility is very simply crafted, but it's important to understand its behavior.

The config object in package.json can contain several sub-objects whose key refers to current env.

The default one will be used, and will be overlapped by the configs according to current process.env.NODE_ENV, if exists.

As in this example:

{
  ...
  "config": {
    "default": {
      "serverPort": "3000",
      "mongo": "mongodb://localhost:27017/production_db",
      "publicPath": "/public"
    },
    "test": {
      "mongo": "mongodb://localhost:27017/test_db"
    }
  }
}

mongo property will normally be mongodb://localhost:27017/production_db;

while with process.env.NODE_ENV setted as 'test', it will be setted to mongodb://localhost:27017/test_db.

The other configurations continue the same.

githalytics.com alpha

Bitdeli Badge

Keywords

di

FAQs

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

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.