etcd-register
API
register
const EtcdRegister = require('etcd-register');
const client = new EtcdRegister({
key: 'backend',
host: '127.0.0.1',
port: 2379
});
client.set({
ip: '192.168.1.1',
port: 80,
host: 'test.com',
prefix: '/albi'
});
client.ttl(600);
client.addTag('http-backend', 'app-albi', 'http-ping');
client.register();
list
const EtcdRegister = require('etcd-register');
const client = new EtcdRegister({
key: 'backend',
host: '127.0.0.1',
port: 2379
});
client.list('backend:http').then(data => {
console.info(data);
});
refresh
const EtcdRegister = require('etcd-register');
const client = new EtcdRegister({
key: 'backend',
host: '127.0.0.1',
port: 2379
});
client.set({
ip: '192.168.1.1',
port: 80,
host: 'test.com',
prefix: '/albi'
});
client.ttl(600);
client.addTag('http-backend', 'app-albi', 'http-ping');
client.register();
setTimeout(() => {
client.refresh();
}, 60 * 1000);
License
MIT