argv-config-file
v0.1.3
Published
Pass a js configuration file on the command line.
Downloads
3
Maintainers
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'
}