@rainder/config

Allows to change server configuration without restarting the service


Keywords
config, autoreload
License
ISC
Install
npm install @rainder/config@0.1.1

Documentation

config autoreload

Basic autoreload wrapper for config module. Allows to change server configuration without restarting the app.

Usage example

const config = require('@rainder/config');

const CONFIG = config.init({
  PASSWORD: 'server.password',
  SSL: {
    ENABLE: 'server.ssl.enable',
  },
});

config.on('reload', () => {
  console.log('config file is changed!');
  
  //credentials are updated
  console.log(CONFIG.PASSWORD);
  
  //standard way of retrieving config is supported
  //even though less preferable
  console.log(config.get('server.password'));  
});