confus

0.0.1 • Public • Published

node-confus

confus is a stream based WebSocket implementation for node.js.

var confus = require('confus');

var config = confus({
  profiles: {
    production: [
      'etc/general',
      'etc/production
    ],
    development: [
      'etc/general',
      'etc/development'
    ]
  },
  root: __dirname + '/../'
});

Installation

The package is available on npm as confus.

npm install --save confus

Documentation

confus(options)

The options argument needs a root property which points to the project root as all require calls must be relative to this root path. The profiles hash contains as key the environment name and an array of config files merged together.

Another nice feature of confus is that it will parse all strings starting with a slash / and replace them by the root path. Through this you avoid ../../../ when configuring external paths from inside your lib directory.

confus.at(profile, callback)

confus.at('*', function() {
  // configure always
});
confus.at('development', function() {
  // only configure in development mode
});

Will execute the assigned callback if profile matches ENV or is *.

License

Copyright 2014 Bodo Kaiser i@bodokaiser.io

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Readme

Keywords

none

Package Sidebar

Install

npm i confus

Weekly Downloads

1

Version

0.0.1

License

BSD/MIT

Last publish

Collaborators

  • bodokaiser
  • nopersonsmodules