1.1.0 • Published 4 months ago

config-reloadable v1.1.0

Weekly downloads
33
License
MIT
Repository
github
Last release
4 months ago

node-config-reloadable

Build and Test npm version

Reloadable version of lorenwest/node-config

Install

npm install --save config-reloadable

Why?

It looks like there is no official support for reloading configuration files; instead, the author suggest a workaround, which, unfortunately, does not always work (for example, if your configuration files are *.js).

config-reloadable forces node-config to reload configuration files by clearing the require cache for both node-config itself and all configuration files that have been loaded.

Example

const config = require('config-reloadable');

console.log(config().something);

// Now change that `something`

config.reloadConfigs();

console.log(config().something);

// Displayed values should differ

Instead of config.reloadConfigs() it is possible to use config(true) (it is less intuitive but makes the code less verbose).

Reload configuration files on SIGHUP:

const config = require('config-reloadable');

let conf = config();

process.on('SIGHUP', function () {
  conf = config.reloadConfigs();
});
1.1.0

4 months ago

1.0.10

7 months ago

1.0.9

3 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago