Coder Social home page Coder Social logo

confo's Introduction

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

confo's People

Contributors

ssbb avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.