Closed michielmulders closed 5 years ago
Yargs
is converting --http-port
to --httpPort
and passes both options (creates an alias). Decided to go for quick fix and allow --httpPort
, so modified regex to allow uppercase chars as well.
{ _: [],
'http-port': 3000,
httpPort: 3000,
'$0': 'lisk/src/index.js' }
Invalid command line arguments specified: http-port
Set {
'log',
'l',
'database',
'd',
'redis',
'r',
'snapshot',
's',
'port',
'p',
'address',
'a',
'peers',
'x',
'httpPort',
'h',
'network',
'n',
'config',
'c' }
At framework/src/controller/validator/keywords/arg/index.js
@michaellightcurve Having camelcase naming for the command line arguments is against the Linux convention. We should match both formats while matching, but only allow -
formats in the command line arguments.
Replace the line below with the script and it will fix.
// Yarg is keeping two arguments in case passed in long format
// Example --http-port, will parse as "httpPort" and "http-port"
// So we also have to keep both values to check any invalid command line argument
this.listOfArgs.add(_.camelCase(arg));
this.listOfArgs.add(arg.replace(/(^--)(.*)/, '$2'));
Expected behavior
Should accept ENV var to modify app behavior.
Actual behavior
Schema validation error:
--> Probably CLI passing args as string and not converting them to specified type.
Also,
--http-port
option does not work as this gets converted to--httpPort
. Starting application withnode lisk/src/index.js --httpPort 3000 | npx bunyan
does work.Which version(s) does this affect? (Environment, OS, etc...)
2.0.0