umai-live-config

0.0.1 • Public • Published

umai-live-config

Build Status GitHub license

Introduction

Based on node-config-live by Josh Newman

Umai-live-config is a lite version node-config-live and adapted for Node.JS 0.10. It allows you to stored, live-updated configurations for your Node.js applications.

Example Usage

Using the module.

var config = require('config'); 
var ConfigLive = require('umai-config-config');
var liveConfig = new LiveConfig('localhost', 6379);
 
liveConfig.start(config);
 
liveConfig.on('error', function(err) {
    // Handle error
});
 
liveConfig.on('started', function(cfg) {
    // Config are ready for use
});
 
// single key set
liveConfig.set('mykey', 'myvalue');
 
// or you can set value and insure that entry was inserted
liveConfig.set('my-host', 'http://some-host')
    .then(function(result) {
        console.log(config['my-host']); // --> `http://some-host`
        console.log(result); // --> `{ key: 'my-host', value: 'http://some-host' }`
    });
 

Tests

Just run:

npm test

TODO:

  • Create set for nested object
  • More tests

Readme

Keywords

Package Sidebar

Install

npm i umai-live-config

Weekly Downloads

0

Version

0.0.1

License

ISC

Last publish

Collaborators

  • abd2561024