refactor: replace DNS resolution method with Python for improved compatibility
This commit is contained in:
@@ -459,7 +459,8 @@ check_dns() {
|
||||
[[ -n "${UNRAID_IP:-}" ]] || return 1
|
||||
|
||||
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
|
||||
|
||||
# Pass only if one of the domain's A records exactly matches UNRAID_IP.
|
||||
|
||||
Reference in New Issue
Block a user