Richard Hansen
18bd312216
Don't initialize $config{$h}
entries to undef
...
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.
2024-08-18 01:22:53 -04:00
Richard Hansen
e8f0358bbb
Rely on opt()
fallback if a value is invalid
2024-08-18 01:22:53 -04:00
Richard Hansen
2b65aff56b
Use opt()
instead of accessing %config
directly
...
This makes it possible to leave `$config{$h}{$var}` undefined to have
it fall back to `%opt`, `%globals`, or the variable's default value.
2024-08-18 01:22:52 -04:00
Richard Hansen
912bc6291a
group_hosts_by: Treat undef
as unset for consistency with opt
...
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.
2024-08-18 01:21:40 -04:00
Richard Hansen
5a66efe79e
Delete unnecessary defined()
check
2024-08-18 00:45:04 -04:00
Richard Hansen
478f517d53
Delete no-effect option normalization
...
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.
2024-08-18 00:45:04 -04:00
Richard Hansen
7fde55c188
Don't initialize %opt
entries to undef
...
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.
2024-08-18 00:45:04 -04:00
Richard Hansen
fe1768316a
Use protocol-specific default when known
...
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.
2024-08-18 00:45:04 -04:00
Richard Hansen
775b7fcbfe
Validate and normalize all command-line arguments
2024-08-18 00:45:04 -04:00
Richard Hansen
bbf98dd031
Use parse_assignments
to process --options
...
This simplifies the code and enables quoting of special characters.
2024-08-18 00:41:28 -04:00
Richard Hansen
270a82dd58
parse_assignments: Support newlines
...
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.
2024-08-18 00:41:28 -04:00
Richard Hansen
4c7634855b
Move *_env
processing to parse_assignment
...
This makes the behavior transparent to the rest of ddclient, which
will make it possible for a future commit to simplify option
processing.
2024-08-18 00:41:28 -04:00
Richard Hansen
19848852a4
check_value: Mention supported values if given an invalid value
2024-08-18 00:41:28 -04:00
Richard Hansen
ed2afde72d
check_value: die
if the value is invalid
...
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.
2024-08-18 00:41:28 -04:00
Richard Hansen
2f8a4ba00a
Use opt()
instead of accessing %opt
or %globals
directly
...
This is for consistency, and to ensure that all possible ways of
configuring are respected.
2024-08-18 00:41:28 -04:00
Richard Hansen
4d3dcdc7de
Move option normalization from usage to load
...
This avoids bugs if a usage forgets to normalize the value.
2024-08-18 00:41:28 -04:00
Richard Hansen
70858e659f
Also warn about non-required values that are invalid
...
Before, only required values that were invalid produced a warning.
Non-required values were quietly ignored.
2024-08-18 00:41:28 -04:00
Richard Hansen
05dbe7a984
Delete confusing and unnecessary T_OFQDN
type
...
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`?
2024-08-18 00:41:28 -04:00
Richard Hansen
9e659a18eb
Move --help
processing to %opt
2024-08-18 00:41:28 -04:00
Richard Hansen
c83dc67039
Remove pointless help
setting
...
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.
2024-08-18 00:41:28 -04:00
Richard Hansen
b4c4b5dc54
Move usage generation to a separate function
2024-08-18 00:41:28 -04:00
Richard Hansen
bd688e9750
Add TODO comments for problematic bits of code
2024-08-18 00:41:28 -04:00
Richard Hansen
ab2e0d7999
hetzner: Quote interpolated value in regex
...
to prevent metacharacter issues.
2024-08-18 00:41:28 -04:00
Richard Hansen
0b79e3bc95
godaddy: Delete redundant condition
2024-08-18 00:41:27 -04:00
Richard Hansen
0c094f6ee8
tests: Fix verbose
option for dnsexit2
protocol tests
...
The `verbose` option is a global option, not a per-host option.
2024-08-18 00:35:44 -04:00
Richard Hansen
a136ba4cdc
tests: Fix ssl
option for dnsexit2
protocol tests
...
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.
2024-08-18 00:35:44 -04:00
Richard Hansen
598dee50ca
Merge pull request #726 from jeffrego/feature_provider_directnic
...
Added support for provider Directnic
2024-08-07 00:06:46 -04:00
Jeff Rego
959b5ddc37
Add support for Directnic provider
2024-08-07 00:06:25 -04:00
Jeff Rego
d497422bf9
Add T_URL type for config properties
2024-08-07 00:06:25 -04:00
Richard Hansen
2330543cc8
dyndns2: Add comment explaining why keys are listed in test
2024-08-05 19:57:18 -04:00
Richard Hansen
13a66c79bb
Merge pull request #729 from tamasbakos/master
...
Removed 5m min-interval from changeip protocol
2024-08-03 18:15:24 -04:00
Tamás
e4d43f0292
Removed min-interval from changeip protocol
...
Removed the min-interval set to 5 minutes in changeip, because according to my tests, changeip has no problem updating every 30 seconds, which is the default min-interval value in ddclient
2024-08-03 11:11:16 +03:00
Richard Hansen
ab27df6f79
Merge pull request #728 from rhansen/dyndns2
...
dyndns2: Fix handling of multi-host response, add tests
2024-08-03 03:36:45 -04:00
Richard Hansen
eb281ea47b
dnsexit2: Rename test file for consistency
2024-08-03 03:32:35 -04:00
Richard Hansen
3d345ff08b
dyndns2: Add tests
2024-08-03 03:32:35 -04:00
Richard Hansen
622abfca2c
repr: New utility function to make it easier to dump values
...
I find Data::Dumper to be awkward to use. This function wraps it so
that I don't have to keep looking up the perldoc.
2024-08-03 03:25:11 -04:00
Richard Hansen
4f369a3b0b
geturl: Simplify headers logic
2024-08-03 03:25:11 -04:00
Richard Hansen
2239b57101
dyndns2: Fix handling of multi-host response
2024-08-03 03:25:11 -04:00
Richard Hansen
7bee2d7c82
dyndns2: Log message improvements
2024-08-03 03:17:52 -04:00
Richard Hansen
143630c7fd
dyndns2: Delete rogue comma
2024-08-03 03:17:52 -04:00
Richard Hansen
a99d093eca
dyndns2: Whitespace fixes
2024-08-03 03:17:52 -04:00
Richard Hansen
60d1c53a36
Merge pull request #727 from rhansen/logger
...
Improvements to the new Logger class
2024-08-03 02:44:54 -04:00
Richard Hansen
43ea691e0c
Logger: Move log output to parentmost Logger
...
This makes it possible for tests to redirect log output so that they
can ensure that certain log messages are generated.
2024-08-02 21:37:14 -04:00
Richard Hansen
f4248d0617
Logger: Separate implementation from interface
...
This makes it easier to override the implementation for testing
purposes.
2024-08-02 21:14:37 -04:00
Richard Hansen
56f8c83d3a
Logger: Check label
for emptiness, not truthiness
2024-08-02 21:05:42 -04:00
Richard Hansen
0f094ac121
Logger: Check msg
and label
for definedness
2024-08-02 21:05:41 -04:00
Richard Hansen
15db76f739
Logger: Accept an arrayref of contexts for ctx
parameter
2024-08-02 20:42:36 -04:00
Richard Hansen
f36c2f45aa
Logger: Always use STDERR as output filehandle
...
There's no good reason for the caller of the `log` method to control
the output filehandle.
2024-08-02 17:03:56 -04:00
Richard Hansen
439b0fd0e1
Logger: Minimize STDERR override in tests
2024-08-02 17:00:00 -04:00
Richard Hansen
1bdd65e46e
Delete unused encode_base64
function
2024-08-02 16:13:56 -04:00