1.0.15 • Published 10 years ago

confo v1.0.15

Weekly downloads
2
License
MIT
Repository
github
Last release
10 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

10 years ago

1.0.14

10 years ago

1.0.13

10 years ago

1.0.12

10 years ago

1.0.11

10 years ago

1.0.10

10 years ago

1.0.9

10 years ago

1.0.8

10 years ago

1.0.7

10 years ago

1.0.6

10 years ago

1.0.4

10 years ago

1.0.3

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago