0.1.4 • Published 9 years ago

dirconf v0.1.4

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

Load configuration files from a directory

This simple module loads all .js files from a given directory, merges the exported objects and returns the result. This is handy if you want to store your configuration parameters in separate files.

Installation

npm install dirconf --save

Usage

Assume you have a configs directory, with the following files in it:

mongodb.js

module.exports = {
  mongodb: {
    host: "localhost",
    port: "31881"
  }
};

mailer.js

module.exports = {
  mailer: {
    method: "SMTP",
    relayHost: "10.10.0.143",
    port: "587"
  }
};

Then you can load the merged configutation object with:

var conf = require('dirconf')('./configs');

In this example conf will contain the merged objects:

{
  mongodb: {
    host: "localhost",
    port: "31881"
  },
  mailer: {
    method: "SMTP",
    relayHost: "10.10.0.143",
    port: "587"
  }
}

License

MIT. See the LICENSE file for details.

0.1.4

9 years ago

0.1.3

10 years ago

0.1.2

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago