couch-daemon-bridge

Use CouchDBs os_daemons with node.

Usage no npm install needed!

<script type="module">
  import couchDaemonBridge from 'https://cdn.skypack.dev/couch-daemon-bridge';
</script>

README

couch-daemon-bridge

Build Status

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 is process.stdin.
  • stdout: output stream. Default is process.stdout.
  • exit: function which is called when stdin closes. Default is to call process.exit(0).

Contributing

  1. Write tests with tap
  2. Lint your code with npm run jshint
  3. Run the tests with npm test

License

Copyright (c) 2014 Johannes J. Schmidt
Licensed under the MIT license.