0.1.2 • Published 8 years ago

configuror v0.1.2

Weekly downloads
2
License
GPL-2.0
Repository
github
Last release
8 years ago

Configuror

Config file loader based on 2 different configuration styles:

  • Global/Local
  • Environment (dev/test/staging/prod/etc)

Supporting multiple file formats:

  • .js
  • .json
  • .yml

Sane defaults included

Quick start

Given the following directory structure in your project root:

config/
  db.js
  api.js

var config = require('configuror')();

config will contain values from files in config/ merged.

Global/Local style configuration

by adding files with .local. preceding the extension allows overriding config options with machine specific values.

config/
  db.js
  api.js
  db.local.js

Environment style configuration

by adding files with .env. preceding the extension allows overriding config options with environment specific values.

config/
  db.js
  api.js
  api.test.js

NODE_ENV=test node app.js

With NODEENV set to test the api.test.js will override values in api.js

Details

Both global/local and environment style configurations can be mixed.

There are no predefined environments such as dev/test/staging/production so you can use any name desired for the environments.

Any of the above mentioned file formats can be used. db.local.yml will override db.js.

File formats

  1. JS

    module.exports = {
      host: "example.com"
    }
  2. JSON

    {
      "user": "jim"
    }
  3. YAML

    ipaddress: 127.0.0.1
0.1.2

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago