-
-
Notifications
You must be signed in to change notification settings - Fork 156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor parse configuration #223
Refactor parse configuration #223
Conversation
Use `getOption` to get the parsed value from the `--config` flag passed.
Using `getOption` on `VALUE_NONE` with either return `true` if set, or `false` if not set.
flags passed via arguments take precedence, but fallback to config file options, or defaults when not passed.
The config is either `true` or `false` which is same as `VALUE_NONE`.
if provided use the option passed otherwise use what is already set in config.
the parsed value with always be set under `tmp-dir` removing the requirement for reading the short option `-t` as well as long `--tmp-dir`. Fall back to config provided unless set.
if ($input->hasParameterOption('--tmp-dir') || $input->hasParameterOption('-t')) { | ||
$this->config['temp_dir'] = $input->getParameterOption('--tmp-dir') ?: $input->getParameterOption('-t'); | ||
} | ||
$this->config['temp_dir'] = $input->getOption('tmp-dir') ?? $this->config['temp_dir']; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using the parsed option will always yield the result under tmp-dir
no need to check the short hand as well.
if ($input->hasParameterOption('--web-host')) { | ||
$this->config['webHost'] = $input->getParameterOption('--web-host'); | ||
} | ||
$this->config['webAllowInsecure'] = $input->getOption('web-allow-insecure'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure how to merge this here, I think this is a bit tricky since not providing it should set it to false, while providing it means true, no matter what the previous config value is. I don't think this is an issue so as previously this was not merged with the config from file either.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dont think its an issue as well.
Thank you! |
Released in |
getOption
where possibleVALUE_NONE
for option--web-allow-insecure
which does not allow for a value to be set.