distributed-config
v0.9.5
Published
Load distributed config files on node js projects, with ability to extend or override settings throw environment variables.
Downloads
3
Maintainers
Readme
Configure your Node.js Applications
Package is under developement
Introduction
This package is writen for systems which have a need of distributed configuration files. This can be of reason system requirements or even of readability or easier organisation of configuration files. It will load all distributed files, independent of file format or path, but depending on set entvironment or machine name and override config settings with environment variables, when defined.
Quick Start
$ npm install dist-config
$ vi default.json
const DistConf = require('dist-config')
const distconf = new DistConf({ config_dirs: './path_to_your_app'})
const myConfiguration = distconf.load()
module.exports = myConfiguration
Singleton
Unlike other configuration modules, we will not create a singleton, so every new implementation will create new instance. If you like to have it single time like a singleton in your node application, just move the initialisation to a file and require where you need it.
File config.js
// file: config.js
// initialise config
const DistConf = require('dist-config')
const distconf = new DistConf({ config_dirs: './path_to_your_app'})
const myConfiguration = distconf.load()
module.exports = myConfiguration
File index.js
// file: index.js
// require initialised config
const myConfig = require('./config')
License
Copyright (c) 2019-present, Alexander Vu