Skip to content

Watch etcd key creation and subsequent changes

Notifications You must be signed in to change notification settings

F4-Group/etcd-watcher

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

etcd-watcher, watch etcd key creation and subsequent changes

Install

You need node-etcd.

$ npm install node-etcd
$ npm install etcd-watcher

Usage

Please note that returned values object will be modified by this library, if you want to compare values between change events, you'll need to clone the returned values.

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'
    },
    key3: { // will fetch all subNodes and return them as objet, also react to any child modification
        etcd: '/foo',
    }
});
watcher.wait(function (err, values) {
    console.log('keys set', values);
    watcher.on('change', function (values) {
        console.log('key change', values);
    })
});

About

Watch etcd key creation and subsequent changes

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 95.8%
  • Shell 4.2%