UNPKG

flipr-etcd

Version:

Flipr source to retrieve config from etcd: a distributed, consistent, partition-tolerant key/value store

32 lines (26 loc) 634 B
'use strict'; /** * Note, this sample won't run unless you have etcd running locally * and you have populated the my-app/config key with some JSON data. */ var FliprEtcd = require('./lib/flipr-etcd'); var source = new FliprEtcd({ directory: 'my-app', key: 'config', host: '10.0.0.200' }); source.on('error', function(){ var args = Array.prototype.slice.call(arguments, 0); args.forEach(function(err){ console.error(err); }); }); source.getConfig(function(err, config){ if(err) console.error(err); else console.dir(config); }); source.watcher.on('change', function(result){ console.log(result); });