etcd-simple-config
Simple config management with Etcd
npm install etcd-simple-config --save
See example.js
API
etcdConfig.bind(prefix, defaultConfig, changeCallback)
Bind etcd path prefix
, providing the default config defaultConfig
, get the current config and start watching for updates with changeCallback
var etcdConfig = '127.0.0.1' 4001; var config = etcdConfig;
config = etcdConfig.get(prefix)
Get config
etcdConfig.set(prefix, obj)
Add or update values
etcdConfig.toJSON(prefix)
Get config, merged with defaultConfig
Listening for events instead of using the change callback
Listen for the 'change' event
var config = etcdConfig; config;
or listen for a single field change
config;