argv-config-file

0.1.3 • Public • Published

Argv Config File

Pass a js or json configuration file on the command line to a Node.js application. Configuration merging is done using config-extend.

Install

npm install --save argv-config-file

Usage

app.js

const argvConfigFile = require('argv-config-file');
 
let config = argvConfigFile({
    // Default config
    // Extended using the file passed on the command line
    foo: ['bar'],
    biz: 'baz'
});

my-config.js

module.exports = {
    // Custom config
    foo: ['array', 'override']
}

my-config.json

{
    "foo": ["array", "override"]
}

Run

node app.js -c /some/directory/my-config.js
node app.js --config=/some/directory/my-config.json

Config Value

{
    foo: ['array', 'override'],
    biz: 'baz'
}

/argv-config-file/

    Package Sidebar

    Install

    npm i argv-config-file

    Weekly Downloads

    6

    Version

    0.1.3

    License

    MIT

    Unpacked Size

    3.29 kB

    Total Files

    8

    Last publish

    Collaborators

    • jmerrick