Config parsing: Allow trailing comments after a backslash in the config
The cloudflare documentation example had lines with a comment after a backslash. This actually did not work in the parser until now. The lines in question: #protocol=cloudflare, \ #zone=domain.tld, \ #ttl=1, \ #login=your-login-email, \ # Only needed if you are using your global API key. If you are using an API token, set it to "token" (without double quotes). #password=APIKey \ # This is either your global API key, or an API token. If you are using an API token, it must have the permissions "Zone - DNS - Edit" and "Zone - Zone - Read". The Zone resources must be "Include - All zones". #domain.tld,my.domain.tld
This commit is contained in:
parent
d195bcc4b8
commit
3c522a7aa2
1 changed files with 8 additions and 3 deletions
11
ddclient.in
11
ddclient.in
|
@ -1619,10 +1619,15 @@ sub _read_config {
|
|||
## remove comments
|
||||
s/#.*//;
|
||||
|
||||
## handle continuation lines
|
||||
## Handle continuation lines
|
||||
# Any line ending in a backslash gets concatenated together with the following line
|
||||
# Note: Trailing whitespace after the backslash is allowed.
|
||||
$_ = "$continuation$_";
|
||||
if (/\\$/) {
|
||||
chop;
|
||||
if (/\\\s*$/) {
|
||||
# Remove the backslash and whitespace
|
||||
s/\\\s*$//s;
|
||||
|
||||
# Store the current line to be prepended to the next line
|
||||
$continuation = $_;
|
||||
next;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue