etcd-watcher

Wait for etcd key creation and watch changes

etcd-watcher, watch etcd key creation and subsequent changes

You need node-etcd.

$ npm install node-etcd
$ npm install etcd-watcher
var Etcd = require('node-etcd');
var etcd = new Etcd();
var etcdWatcher = require('etcd-watcher');
 
var watcher = etcdWatcher.watcher(etcd, {
    key1: {
        required: true,
        etcd: '/foo/bar/key1' 
    },
    key2: {
        required: false,
        default: 'defaultValue'
    }
});
watcher.wait(function (errvalues) {
    console.log('keys set', values);
    watcher.on('change', function (values) {
        console.log('key change', values);
    })
});