couch-daemon-bridge
v2.0.3
Published
Use CouchDBs os_daemons with node.
Downloads
17
Readme
couch-daemon-bridge
Ease the use of CouchDBs
os_daemons
with node.
Usage
var daemon = require('couch-daemon-bridge')();
// Log a message
daemon.info('My daemon is starting.');
daemon.debug('I have so much wow...');
daemon.error('An error occured!');
// Request configuration
daemon.get('httpd', function(err, data) {
// data is now an object holding the whole httpd section
});
daemon.get('httpd.bind_address', function(err, data) {
// data is now a string holding the value
});
Environment Variables
Every configuration can be overridden via environment variable:
export HTTPD_BIND_ADDRESS="93.184.216.119"
var daemon = require('couch-daemon-bridge')();
// Request configuration
daemon.get('httpd.bind_address', function(err, data) {
// data is now a string holding the value of HTTPD_BIND_ADDRESS if present
});
Configuration
couch-daemon-bridge takes an object as an optional argument:
stdin
: input stream. Default isprocess.stdin
.stdout
: output stream. Default isprocess.stdout
.exit
: function which is called when stdin closes. Default is to callprocess.exit(0)
.
Contributing
- Write tests with tap
- Lint your code with
npm run jshint
- Run the tests with
npm test
License
Copyright (c) 2014 Johannes J. Schmidt
Licensed under the MIT license.