2.0.0 • Published 4 years ago

@fabien0102/config-manager v2.0.0

Weekly downloads
3
License
MIT
Repository
github
Last release
4 years ago

Config-manager npm version

Simple module to have configs from a folder. This module manage *.local.js and local.js overrides to have an easy way to have dev configs ;).

How to install

Simply do npm i --save @fabien0102/config-manager.

Examples

Simple configuration

configs/bdd.js

module.exports.bdd = {
  host: "production.mongo.com"
}

app.js

var config = require('@fabien0102/config-manager')('/configs');

console.log(config.bdd.host); // -> 'production.mongo.com'

Local override with namespace

configs/bdd.js

module.exports.bdd = {
  host: "production.mongo.com"
}

configs/bdd.local.js

module.exports.bdd = {
  host: "localhost"
}

app.js

var config = require('@fabien0102/config-manager')('/configs');

console.log(config.bdd.host); // -> 'localhost'

Local override without namespace

configs/global.js

module.exports = {
  bdd: {
    host: "production.mongo.com"
  }
}

configs/local.js

module.exports = {
  bdd: {
    host: "localhost"
  }
}

app.js

var config = require('@fabien0102/config-manager')('/configs');

console.log(config.bdd.host); // -> 'localhost'
2.0.0

4 years ago

1.0.1

8 years ago

1.0.0

8 years ago