refactor: replace DNS resolution method with Python for improved compatibility

This commit is contained in:
S
2026-03-01 08:58:44 -05:00
parent 24d7df0a0b
commit 135a0b7c0c

View File

@@ -459,7 +459,8 @@ check_dns() {
[[ -n "${UNRAID_IP:-}" ]] || return 1 [[ -n "${UNRAID_IP:-}" ]] || return 1
local resolved local resolved
resolved=$(dig +short "${GITEA_DOMAIN}" A 2>/dev/null | sed '/^[[:space:]]*$/d') || return 1 # Use python3 (bundled with macOS) for DNS — avoids dependency on dig/host/nslookup
resolved=$(python3 -c "import socket; print('\n'.join(r[4][0] for r in socket.getaddrinfo('${GITEA_DOMAIN}', None, socket.AF_INET)))" 2>/dev/null | sort -u) || return 1
[[ -n "$resolved" ]] || return 1 [[ -n "$resolved" ]] || return 1
# Pass only if one of the domain's A records exactly matches UNRAID_IP. # Pass only if one of the domain's A records exactly matches UNRAID_IP.