umai-live-config
v0.0.1
Published
Live updating and management of config in NodeJS.
Downloads
2
Readme
umai-live-config
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