diff options
author | Evgeny Zinoviev <me@ch1p.io> | 2021-03-07 19:41:43 +0300 |
---|---|---|
committer | Evgeny Zinoviev <me@ch1p.io> | 2021-03-07 19:41:43 +0300 |
commit | db7e1be9b58ba92556d579cd4b814ae083602bc9 (patch) | |
tree | 36b8a67e7f0c87286616b61d6794ff6e58726f8e /src/jobd-master.js | |
parent | e19982e9736cebb3f52a146fbc5f0579b70827e9 (diff) |
jobctl
Diffstat (limited to 'src/jobd-master.js')
-rwxr-xr-x | src/jobd-master.js | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/jobd-master.js b/src/jobd-master.js index 5839b1a..c926dc0 100755 --- a/src/jobd-master.js +++ b/src/jobd-master.js @@ -8,6 +8,8 @@ const {validateObjectSchema, validateTargetsListFormat} = require('./lib/data-va const RequestHandler = require('./lib/request-handler') const package_json = require('../package.json') +const DEFAULT_CONFIG_PATH = "/etc/jobd-master.conf" + /** * @type {Logger} */ @@ -51,7 +53,12 @@ async function initApp(appName) { process.on('SIGINT', term) process.on('SIGTERM', term) - const argv = minimist(process.argv.slice(2)) + const argv = minimist(process.argv.slice(2), { + boolean: ['help', 'version'], + default: { + config: DEFAULT_CONFIG_PATH + } + }) if (argv.help) { usage() @@ -63,9 +70,6 @@ async function initApp(appName) { process.exit(0) } - if (!argv.config) - throw new Error('--config option is required') - // read config try { config.parseMasterConfig(argv.config) @@ -295,9 +299,9 @@ function usage() { let s = `${process.argv[1]} OPTIONS Options: - --config <path> - --help - --version` + --config <path> Path to config. Default: ${DEFAULT_CONFIG_PATH} + --help Show this help. + --version Print version.` console.log(s) } |