1.0.15 • Published 9 years ago

confo v1.0.15

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

confo - simple config file reader

img img img img img img

Managing configs for different environments (based on NODE_ENV variable) in js or json format.

How to use

  • Install it with npm install confo
  • Create a confo.json file in the same folder as the main entry point (usually project root). This file must contain a NODE_ENV: PATH JSON object like this:

    {
      "dev": "./config/environments/dev.js",
      "production": "./config/environments/production.js",
      "test": "./config/environments/test.js"
    }

    Also you can set CONFO_FILE environment variable with full path to confo.json file.

  • Create a config file. I prefer to write config files with JavaScript. It gives me the opportunity to use the language features like path joining or extending a base config. But you can use JSON as well.

    var config = require('./base.js');
    
    config.db.port = 28017;
    config.db.host = '127.0.0.1';
    
    module.exports = config;
  • Just require confo and use it:

    var confo = require('confo');
    
    console.log(confo.db.host);
  • That's all!

License

MIT

1.0.15

9 years ago

1.0.14

9 years ago

1.0.13

9 years ago

1.0.12

9 years ago

1.0.11

9 years ago

1.0.10

9 years ago

1.0.9

9 years ago

1.0.8

9 years ago

1.0.7

9 years ago

1.0.6

9 years ago

1.0.4

9 years ago

1.0.3

9 years ago

1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago