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

    figcpublic

    figc

    Merge config files with command-line arguments.

    build status

    examples

    server

    server.js:

    var figc = require('figc');
    var config = figc(__dirname + '/config.json');
     
    var http = require('http');
     
    var server = http.createServer(function (req, res) {
        res.end(config.msg + '\n');
    });
    server.listen(config.port);

    config.json:

    {
        "port" : 8085,
        "msg" : "..."
    }

    default output:

    $ node server.js &
    [1] 19109
    $ curl -sN http://localhost:8085
    ...

    custom port and message:

    $ node server.js --msg='beep boop' --port=8086 &
    [1] 19114
    $ curl -sN http://localhost:8086
    beep boop

    methods

    var figc = require('figc');

    var config = figc(configFile, argv=process.argv)

    Load a json configuration from configFile and merge its contents with argv which will be parsed by optimist.

    install

    With npm do:

    npm install figc
    

    license

    MIT/X11

    Keywords

    none

    install

    npm i figc

    Downloadsweekly downloads

    147

    version

    0.0.3

    license

    none

    repository

    github.com

    last publish

    collaborators

    • avatar