distributed-config
TypeScript icon, indicating that this package has built-in type declarations

0.9.5 • Public • Published

Configure your Node.js Applications

Build Status codecov

js-standard-style

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

MIT

Copyright (c) 2019-present, Alexander Vu

Package Sidebar

Install

npm i distributed-config

Weekly Downloads

1

Version

0.9.5

License

MIT

Unpacked Size

20.7 kB

Total Files

11

Last publish

Collaborators

  • alexsedeke