Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    nor-configpublic

    Build Status

    nor-config -- Config library for Node.js

    Warning! This code is experimental and in a state of preliminary development. Use at your own risk.

    License

    It's under MIT-style open source license -- see https://github.com/Sendanor/nor-config/blob/master/LICENSE.txt.

    Installation

    You can install it simply from NPM:

    npm install nor-config
    

    Usage

    App defaults can be configured in file ./config.json (or later in the source code with ._def()):

    {
      "port": 8080
    }

    Local settings (overrides values in ./config.js) for the app can be set in ./local/config.json:

    {
      "host": '192.168.1.1',
      "port": 3000
    }

    The ./app.js uses it like this:

    var config = require('nor-config').from(__dirname);
    config._def('host', 'localhost');   // Set default value
    config._require('port');            // If port is missing, throws an exception.
    console.log(config.host + ':' + config.port);

    The output will be 192.168.1.1:3000.

    The library will also read package.json if it exists, and saves contents from it to config.pkg.

    Keywords

    none

    install

    npm i nor-config

    Downloadsweekly downloads

    5

    version

    0.1.1

    license

    none

    repository

    githubgithub

    last publish

    collaborators

    • avatar