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

ravel-etcd-config

v0.18.0

Published

Distributed Ravel configuration via etcd

Downloads

9

Readme

ravel-etcd-config

Distributed Ravel configuration via etcd

GitHub license npm version Dependency Status npm Build Status Code Climate Test Coverage

Ravel has a managed configuration system which is traditionally supplied values via a .ravelrc file. While this is convenient for development, production deployments with replicated Ravel apps benefit from utilizing a distributed configuration approach. To that end, this module provides a mechanism for loading configuration parameters from etcd, a popular open-source key/value store which is often utilized for this purpose.

This module can be used with any version of etcd which supports the v2 API (this includes etcd 3.x).

Example Usage:

Load parameters into a folder in etcd using the tool or language of your choice:

# Notice that parameters live within the ravelrc directory by default,
# and that parameter names with spaces are supported.
$ etcdctl set "/ravelrc/redis host" 1.2.3.4
$ etcdctl set "/ravelrc/redis port" 6379
$ etcdctl set "/ravelrc/my object parameter" "{\"a\": 1, \"b\": 2}"

Then consume the parameters in your Ravel application:

app.js

const app = new require('ravel')();
const EtcdConfig = require('ravel-etcd-config');
new EtcdConfig(app);
// OPTIONAL: set connection host. It'll hit 127.0.0.1:2379 by default.
app.set('config etcd host', 'http://1.2.3.4:2379');
// OPTIONAL: set connection parameters. {timeout: 5000} by default.
// see https://github.com/stianeikeland/node-etcd for options
app.set('config etcd options', {timeout: 1000});
// ... other providers and parameters
app.modules('./modules');
app.resources('./resources');
// ... the rest of your Ravel app
app.init();
app.listen();

Advanced Usage:

If you wish to utilize a unique directory name for your configuration parameters, or even load parameters from multiple directories, you can supply a name manually:

# Notice that parameters live within the ravelrc directory by default,
# and that parameter names with spaces are supported.
$ etcdctl set "/ravelrc/redis host" 1.2.3.4
$ etcdctl set "/customer1/redis port" 6379
$ etcdctl set "/customer1/my object parameter" "{\"a\": 1, \"b\": 2}"

.ravelrc

{
  "config etcd host": "http://1.2.3.4:2379",
  "config etcd options": {
    "timeout": 1000
  }
}

app.js

const app = new require('ravel')();
const EtcdConfig = require('ravel-etcd-config');
// in this example, .ravelrc configures etcd and all other params are loaded from there
new EtcdConfig(app); // this loads from /ravelrc by default
new EtcdConfig(app, 'customer1'); // this will load from /customer1
// ... other providers and parameters
app.modules('./modules');
app.resources('./resources');
// ... the rest of your Ravel app
app.init();
app.listen();