-
Notifications
You must be signed in to change notification settings - Fork 369
Option processing improvements #733
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The `ssl` option is a global option, not a per-host option. This
commit could instead do:
local $ddclient::globals{ssl} = 0;
but it's more straightforward to include `http://` in the `server`
option, and it tests that `server` supports the inclusion of the
scheme.
The `verbose` option is a global option, not a per-host option.
to prevent metacharacter issues.
This does not affect the `--help` command-line argument. The `help` setting didn't do anything useful, and it didn't make sense to set `help=1` in the config file (or pass `--options=help=1`), so this removal is unlikely to affect anyone. If the setting does exist, the user will get a warning and the setting will be ignored.
Variable declarations already have a `required` flag, which makes the type confusing. What would it mean for a variable to be a required `T_OFQDN`? And how would an optional `T_FQDN` differ from an optional `T_OFQDN`?
Before, only required values that were invalid produced a warning. Non-required values were quietly ignored.
This avoids bugs if a usage forgets to normalize the value.
This is for consistency, and to ensure that all possible ways of configuring are respected.
This makes it possible to convey details about why the value was deemed invalid. It also allows `undef` to be treated as a valid value.
This makes the behavior transparent to the rest of ddclient, which will make it possible for a future commit to simplify option processing.
Allow newlines to be in values, but stop searching for assignments once an unescaped/unquoted newline is discovered. This is preparation to using `parse_assignments` to process the `--options` command-line argument, which might have embedded newlines.
This simplifies the code and enables quoting of special characters.
Different protocols can have different default values for a particular variable. Grab the protocol-specific variable definition if given a hostname when looking up the variable's default.
There's no need -- if the key doesn't exist the value returned is already `undef`. This prevents debug output from being littered with `undef` lines.
The alternative is to "fix" the code to match the original intention, but users haven't been complaining so it's better to avoid the risk of introducing a new bug in the fix.
The `opt` function falls back to global/default if the value is undefined, even if it is explicitly set to `undef`. `group_hosts_by` should behave the same.
This makes it possible to leave `$config{$h}{$var}` undefined to have
it fall back to `%opt`, `%globals`, or the variable's default value.
There's no need -- if the key doesn't exist the value returned is already `undef`. This prevents debug output from being littered with `undef` lines.
rhansen
added a commit
that referenced
this pull request
Aug 18, 2024
I forgot to update these before merging PR #733.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.