diff --git a/nix-system-configs/modules/system/traefik.nix b/nix-system-configs/modules/system/traefik.nix index 0123ff2..7654cb2 100644 --- a/nix-system-configs/modules/system/traefik.nix +++ b/nix-system-configs/modules/system/traefik.nix @@ -674,6 +674,9 @@ in { else auth_header="Authorization: Bearer" fi + # Output for debugging + ${pkgs.util-linux}/bin.logger -s "DDNS Updater: Using auth_method ''${auth_method} with header ''${auth_header}" + ########################################### ## Seek for the A record @@ -685,6 +688,10 @@ in { -H "''$auth_header ''$auth_key" \ -H "Content-Type: application/json") + # Output for debugging + CURL_EXIT=$? + ${pkgs.util-linux}/bin.logger -s "DDNS Updater: Cloudflare GET exit=$CURL_EXIT response=$record" + ########################################### ## Check if the domain has an A record ########################################### @@ -692,6 +699,9 @@ in { ${pkgs.util-linux}/bin/logger -s "DDNS Updater: Record does not exist, perhaps create one first? (''${CURRENT_IP} for ''${record_name})" exit 1 fi + # Output for debugging + ${pkgs.util-linux}/bin.logger -s "DDNS Updater: Record found for ''${record_name}, checking IP..." + ########################################### ## Get existing IP @@ -702,11 +712,17 @@ in { ${pkgs.util-linux}/bin/logger "DDNS Updater: IP ($CURRENT_IP) for ''${record_name} has not changed." exit 0 fi + # Output for debugging + ${pkgs.util-linux}/bin.logger -s "DDNS Updater: Current IP ($CURRENT_IP) is different from old IP ($old_ip) for ''${record_name}, updating record..." + ########################################### ## Set the record identifier from result ########################################### record_identifier=$(echo "$record" | sed -E 's/.*"id":"([A-Za-z0-9_]+)".*/\\1/') + # Output for debugging + ${pkgs.util-linux}/bin.logger -s "DDNS Updater: Record identifier for ''${record_name} is ''${record_identifier}" + ########################################### ## Change the IP@Cloudflare using the API