Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/alexsedeke/distributed-config
Load distributed config files on node js projects, with ability to extend or override settings throw environment variables.
https://github.com/alexsedeke/distributed-config
Last synced: 2 months ago
JSON representation
Load distributed config files on node js projects, with ability to extend or override settings throw environment variables.
- Host: GitHub
- URL: https://github.com/alexsedeke/distributed-config
- Owner: alexsedeke
- License: mit
- Created: 2019-01-29T09:14:02.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2023-02-28T07:37:56.000Z (almost 2 years ago)
- Last Synced: 2024-11-01T15:47:18.476Z (2 months ago)
- Language: JavaScript
- Size: 905 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Configure your Node.js Applications
[![Build Status](https://travis-ci.org/alexanderVu/distributed-config.svg?branch=master)](https://travis-ci.org/alexanderVu/distributed-config)
[![codecov](https://codecov.io/gh/alexanderVu/distributed-config/branch/master/graph/badge.svg)](https://codecov.io/gh/alexanderVu/distributed-config)[![js-standard-style](https://cdn.rawgit.com/standard/standard/master/badge.svg)](http://standardjs.com)
**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
```shell
$ npm install dist-config
$ vi default.json
``````js
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
```js
// file: config.js
// initialise configconst DistConf = require('dist-config')
const distconf = new DistConf({ config_dirs: './path_to_your_app'})
const myConfiguration = distconf.load()module.exports = myConfiguration
```
File index.js
```js
// file: index.js
// require initialised configconst myConfig = require('./config')
```
## License
[MIT](http://opensource.org/licenses/MIT)
Copyright (c) 2019-present, Alexander Vu