Socket
Socket
Sign inDemoInstall

config-etcd

Package Overview
Dependencies
40
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    config-etcd

get config values from etcd in a deep structure


Version published
Weekly downloads
2
increased by100%
Maintainers
1
Install size
2.42 MB
Created
Weekly downloads
 

Readme

Source

config-etcd

Configure your app with values from etcd with a simple API.

Features
  • Get etcd keys to configure your app
  • Let etcd directives sit with other configurations for later lookup
  • Recursively evaluate a structure looking for directives to retrieve values from etcd
  • Callback is guarenteed to execute after config has been updated
  • In-place configuration update
  • Works with any configuration method

Install

npm install config-etcd --save

Use

Use whatever method you want to get configuration values into your app. (I prefer the config module).

Lets suppose that the etcd key /services/db/password contains the value foobar.

var config = {
    'db': {
        'host': '127.0.0.1',
        'port': 12345,
        'password': 'etcd:/services/db/password'
    }
}

var etcd_hosts = ['127.0.0.1:4001']

var configEtcd = require('config-etcd')

configEtcd(etcd_hosts, config, function (err, updated_config) {
    if (err) throw err
    console.log('Successfully updated config with values from etcd:', updated_config)
})

This will print the new updated config structure:

{
    'db': {
        'host': '127.0.0.1',
        'port': 12345,
        'password': 'foobar'
    }
}

Alternatively, you can omit the etcd_hosts parameter to just initialize with [127.0.0.1:4001 as your etcd address.

License

MIT license in LICENSE file.

Keywords

FAQs

Last updated on 23 Dec 2014

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc