1.0.2 • Published 9 years ago

etcd-config v1.0.2

Weekly downloads
5
License
MIT
Repository
github
Last release
9 years ago

node-etcd-config

Returns a configuration object from etcd

Usage

// initiate EtcdConfig
var appConfig = new EtcdConfig({connectionString: 'http://127.0.0.1:4001/', jsonKeys: true });

// identify application
appConfig.identify('my-app');

// load the configuration
appConfig.load(function (err, config) {
    console.log('config loaded: %j', config);

    appConfig.on('changed', function (item) {
        console.log('key %s changed', item.key);
    });
});

Options

passed as an object to constructor

  • connectionString: url of etcd http api (required)
  • jsonKeys: set to true if configuration values saved as JSON in etcd. Defaults to false (optional)

Methods

  • identify(applicationName): identifies where to find the etcd keys for config using tree pattern /applications/{applicationName}
  • load(callback): callback called when config parsed from etcd. Callback signature is function(err, config)

Events

  • 'changed': fired on changes to etcd keys, returning a changed object

Testing

To run the tests, an instance of etcd must be available at http://127.0.0.1:4001

1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago

0.1.1

9 years ago

0.1.0

9 years ago