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

config-live

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

config-live

Live updating and management of config across your stack in NodeJS.

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

node-config-live

Build Status GitHub license

Introduction

Config-live takes away the pain of reloading your NodeJS applications when configurations change. It uses a simple implementation of external caching and pub/sub for updates.

Right now config-live uses Redis for it's caching of config key/values and pub/sub features. Bringing your own caching and pub/sub is in the works and will be implemented as addons.

Props to Stack Overflow for their NFig package that has inspired this!

Important things to note:

  • NodeJS 4+ required
  • No authentication is built in this package yet. e.g. username/password
  • This module assumes that you are on a per environment setup. (One Redis instance per environment)

Installation

npm i -S config-live

Example Usage

Using the config module.

const config     = require('config'); // if you are using config
const ConfigLive = require('config-live');
const configLive = new ConfigLive('localhost', 6379);

// config is an object
configLive.start(config);

configLive.on('error', err => {
    // DO SOMETHING. IT'S ON FIRE.
});

configLive.on('started', cfg => {
    // since the config module is global, this is useful for a fully merged update
    config.util.extendDeep(config, cfg);
});

// you can listen to the full updated config
configLive.on('updated', cfg => {
    // do something here?
});

// or you can listen to a specific simple key being updated
configLive.on('mykey-updated', value => {
    // can do something with new value
});

// or you can listen to a specific nested key being updated
configLive.on('mykey.mysecondkey-updated', value => {
    // can do something with new value
});

// single key set
configLive.set('mykey', 'myvalue');

// nested object key set
configLive.set('mykey.mysecondkey', 'myvalue');

Debugging

DEBUG=config-live* node myapp.js

More documentation coming soon!

Keywords

FAQs

Package last updated on 11 Jun 2016

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