umai-live-config

Live updating and management of config in NodeJS.

Usage no npm install needed!

<script type="module">
  import umaiLiveConfig from 'https://cdn.skypack.dev/umai-live-config';
</script>

README

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