1.3.0 • Published 8 years ago

etcd-simple-config v1.3.0

Weekly downloads
4
License
MIT
Repository
github
Last release
8 years ago

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 = new EtcdSimpleConfig('127.0.0.1', 4001);

var config = etcdConfig.bind(prefix, defaultConfig, function(key, change){
	console.log('Config changed', change, config);
});

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.bind(prefix, defaultConfig, true);

config.on('change', function(key, change){
	console.log('on change', arguments);
});

or listen for a single field change

config.on('change:max_requests', function(key, change){
	console.log('on max_requests change', arguments);
});
1.3.0

8 years ago

1.2.0

8 years ago

1.1.0

8 years ago

1.0.8

8 years ago

1.0.7

8 years ago

1.0.6

9 years ago

1.0.5

9 years ago

1.0.3

9 years ago

1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago