argv-config-file

Pass a js configuration file on the command line.

Usage no npm install needed!

<script type="module">
  import argvConfigFile from 'https://cdn.skypack.dev/argv-config-file';
</script>

README

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'
}