npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

lib-config-etcd

v0.4.1

Published

config lib with etcd support

Downloads

12

Readme

lib-config-etcd

config lib with etcd support

Installation

$ npm install config-etcd --save

Benutzung

NODE_ENV

Set this environment var in your home-directory (eg. ~/.bash_profile) or run this application with --NODE_ENV=...

Necessary files

  • config/config.json
  • config/{env}.json (where ENV is the environment var NODE_ENV)

ENV

config-etcd can load values form envioronment variable. Use the prefix ENV:: to load a config value from an environment variable:

$ export MYKEY=0123456789

Used in config.json:

{
    "config": {
       "key": "ENV::MYKEY"
    }
}

ETCD

Using ETCD

ETCD is a highly-available key value store for shared configuration and service discovery. You can define configuration options that will result in an etcd lookup by using an ETCD_HOST:: and ETCD_PORT:: prefix like this in your config file:

{
    "config": {
       "serviceLocationHost": "ETCD_HOST::myService"
       "serviceLocationPort": "ETCD_PORT::myService"
    }
}

To alow config-etcd to find service in ETCD, the service has to be registerd e.g. by using discover config-etcd uses internal the discover-client

Configuring ETCD

config-etcd uses envioronment variable or CLI-parameter ETCD_HOST, ETCD_PORT, ETCD_PREFIX to find the ETCD Servers.

Default values are the following

  • ETCD_HOST localhost
  • ETCD_PORT 4001
  • ETCD_PREFIX discover

Example.coffee

configEtcd = require 'config-etcd'

configEtcd.on 'loaded', ->
  config = configEtcd.getConfig()
  # start application

configEtcd.on 'changed', ->
  newConfig = configEtcd.getConfig()
  # reconfigure application

configEtcd.load()

see folder examples

Api-Dokumentation

[doc/index.html]

Methoden

load(configPath, callback)

configPath

Type: String Default value: ./config

callback

Type: Function Default value: null

load() load's the config. Config loading is async since it has to make network calls to etcd.

getConfig()

getConfig() get the current config values. Only avalible after the loaded event got fired.

on(event, cb)

event

Type: String Default value: null

callback

Type: Function Default value: null

on('event', cb) register event handler

Events

loaded

event fires when config is load and getConfig() can be used.

changed

event fires when a config change in etcd happes. To get the updated config value use getConfig()

Development

use git-flow!

clone repo
$ git clone [email protected]:valiton/node-lib-config-etcd.git
install dependencies
$ npm install
Development-Workflow/ and watch (each code change restarts the build)
$ grunt dev
lint, test and build api-docs

runs internal grunt

$ npm test
create release
$ grunt release:xxx ( xxx = major || minor || patch )

Release History

0.1.0 - Initial Version

Authors (Valiton GmbH)

  • Johannes Stark
  • Benedikt Weiner
  • Bastian Behrens

License

Copyright (c) 2015 Valiton GmbH Licensed under the MIT license.