From 533e4735cd2d08890e8893325b2b5a483132eaca Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Sun, 18 Aug 2024 02:44:40 -0400 Subject: [PATCH] init_config: Support any variable as a command-line arg This doesn't add any new command-line arguments, but it does mean that a new command-line argument can be added for any variable, not just those in `$variables{'global-defaults'}`, and its value will be copied to `%globals`. My main motivation for this commit is to make it possible to remove the redundant variable declarations between `$variables{'global-defaults'}` and `$variables{'protocol-common-defaults'}`. --- ddclient.in | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/ddclient.in b/ddclient.in index 6236c94..24e4c52 100755 --- a/ddclient.in +++ b/ddclient.in @@ -1923,9 +1923,7 @@ sub init_config { ## override global options with those on the command-line. for my $o (keys %opt) { - # TODO: Why is this limited to $variables{'global-defaults'}? Why not - # $variables{'merged'}? - if (defined $opt{$o} && exists $variables{'global-defaults'}{$o}) { + if (defined $opt{$o} && exists $variables{'merged'}{$o}) { # TODO: What's the point of this? The opt() function will fall back to %globals if # %opt doesn't have a value, so this shouldn't be necessary. $globals{$o} = $opt{$o};