egg-etcd
v0.0.5
Published
egg Etcd plugin
Downloads
8
Maintainers
Readme
egg-etcd
Install
$ npm i egg-etcd --save
Usage
// {app_root}/config/plugin.js
exports.eggEtcd = {
enable: true,
package: 'egg-etcd',
};
Configuration
// {app_root}/config/config.default.js
exports.eggEtcd = {
hosts: [
'your-etcd-cluster1.host.com',
'your-etcd-cluster2.host.com',
'your-etcd-cluster3.host.com',
],
auth: {
username: 'your_user_name',
password: 'your_password',
},
};
see config/config.default.js for more detail.
Example
// app.js
// get value
app.etcd.get('foo').string().then(value => {
console.log('foo value is:', value);
});
// watch value
app.etcd
.watch()
.key('bar')
.create()
.then(watcher => {
watcher.on('put', res => {
console.log('bar value is:', res.value);
});
});
More Info
This plugin is based on Etcd3, you can read Etcd3 document for more info.
Questions & Suggestions
Please open an issue here.