From: Wolfgang Link Date: Tue, 31 Mar 2020 06:53:45 +0000 (+0200) Subject: Add debug mode X-Git-Url: https://git.proxmox.com/?p=proxmox-acme.git;a=commitdiff_plain;h=54fd0088c11e2f2fcbcf8bdd83ac581000a9acd7 Add debug mode This can be used at setup time to get feedback on the DNS plugin parameters. Signed-off-by: Wolfgang Link --- diff --git a/src/proxmox-acme b/src/proxmox-acme index ff9fec8..566588f 100644 --- a/src/proxmox-acme +++ b/src/proxmox-acme @@ -9,6 +9,8 @@ USER_AGENT="$PROJECT_NAME/$VER" DNS_PLUGIN_PATH="/usr/share/proxmox-acme/dnsapi" HTTP_HEADER="$(mktemp)" +DEBUG="0" + _base64() { openssl base64 -e | tr -d '\r\n' } @@ -532,27 +534,31 @@ _cleardomainconf() { } _debug() { - return + if [[ $DEBUG -eq 0 ]]; then + return + fi + printf -- "%s" "[$(date)] " >&1 + echo "$1 $2" } _debug2() { - return + _debug $1 $2 } _debug3() { - return + _debug $1 $2 } _secure_debug() { - return + _debug $1 $2 } _secure_debug2() { - return + _debug $1 $2 } _secure_debug3() { - return + _debug $1 $2 } _saveaccountconf() { @@ -601,6 +607,7 @@ _load_plugin_config() { # $2 Fully Qualified Domain Name # $3 value for TXT record # $4 DNS plugin auth and config parameter separated by "," +# $5 0 is off, and the default all others are on. setup() { dns_plugin="dns_$1" @@ -608,6 +615,7 @@ setup() { fqdn="_acme-challenge.$2" txtvalue=$3 plugin_conf_string=$4 + DEBUG=$5 _load_plugin_config @@ -634,6 +642,7 @@ teardown() { fqdn="_acme-challenge.$2" txtvalue=$3 plugin_conf_string=$4 + DEBUG=$5 _load_plugin_config