0.1.1 • Published 8 years ago

confabulous-etcd-loader v0.1.1

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

[Build Status(https://travis-ci.org/guidesmiths/confabulous-etcd-loader)

Confabulous Etcd Loader

Confabulous-Etcd-Loader is an Etcd Loader for Confabulous - a hierarchical, asynchronous config loader and post processor.

TL;DR

const confabulous = require('confabulous')
const etcd = require('confabulous-etcd-loader')
const Confabulous = confabulous.Confabulous
const processors = confabulous.processors

new Confabulous()
    .add((config) => etcd({ hosts: ['etcd.example.com:2379'], key: 'config' }, [
        processors.json()
    ]))
    .on('loaded', (config) => console.log('Loaded', JSON.stringify(config, null, 2)))
    .on('reloaded', (config) => console.log('Reloaded', JSON.stringify(config, null, 2)))
    .on('error', (err) => console.error('Error', err))
    .on('reload_error', (err) => console.error('Reload Error', err))
    .end()

Options

OptionTypeDefaultNotes
hostsarrayArray of etcd hosts
keystringKey from which to load config
mandatorybooleantrueCauses an error/reload_error to be emitted if the configuration does not exist
watchbooleantrueUses node-etcd's watcher to monitor the key for changes
etcdobjectoptions that will be passed to the underlying etcd client.