Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

nconf-etcd2

Package Overview
Dependencies
Maintainers
2
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nconf-etcd2

An Etcd2 backend for nconf

  • 1.4.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
2
Created
Source

nconf-etcd2 Build Status

An nconf backend store for Etcd2

npm install nconf nconf-etcd2 --save

An ETCD2 backend for nconf

var Store = require('nconf-etcd2')
var s = new Store({namespace:'test'});
var assert = require('assert')

s.load(function(err,data){
	assert.equal( err, null )
	s.set('a:b:c:d',2);
	s.save(function( err ){
		s.store = {};

		s.load( function(e,d){
			assert.equal( 2,~~s.get('a:b:c:d') );
			done();
		});
	});
});

Usage with nconf

var nconf = require('nconf');
var Etcd  = require('nconf-etcd2'); // tries to attach to the nconf instance

nconf.use('etcd', { /* options */ });
nconf.load(console.log);

Support For Syncronous Methods

var nconf = require('nconf');
var Etcd  = require('nconf-etcd2'); // tries to attach to the nconf instance

nconf.use('etcd', { namespace:'test', hosts:['192.168.0.1:4001', '10.50.5.1:4001']});
nconf.load();
nconf.set( 'a:b:c', 1);
nconf.save(); // Saved to etc!

Nest Namespaces

var nconf = require('nconf');
var Etcd  = require('nconf-etcd2'); // tries to attach to the nconf instance

nconf.use('etcd', { namespace:'test:foo', hosts:['192.168.0.1:4001', '10.50.5.1:4001']});
nconf.load();

nconf.get( 'a:b:c');
nconf.save(); // Saved to etc!

Custom Separators


var nconf = require('nconf');
var Etcd  = require('nconf-etcd2'); // tries to attach to the nconf instance

nconf.use('etcd', { namespace:'test-nested', logicalSeparator:'-' hosts:['192.168.0.1:4001', '10.50.5.1:4001']});
nconf.load();
nconf.set( 'a-b-c', 1);
nconf.save(); // Saved to etc!

Keywords

FAQs

Package last updated on 23 Nov 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc