fix: make backend DNS check optional when getent is unavailable
Add getent availability check before attempting DNS resolution in wait_for_backend_dns function. Fall back to allowing curl connectivity check in main loop when getent is not available, supporting Alpine-based images that don't ship getent by default.
This commit is contained in:
@@ -57,12 +57,18 @@ NFT_CONF="/var/lib/nexavpn/nftables.generated.conf"
|
|||||||
mkdir -p /etc/wireguard
|
mkdir -p /etc/wireguard
|
||||||
|
|
||||||
wait_for_backend_dns() {
|
wait_for_backend_dns() {
|
||||||
|
if command -v getent >/dev/null 2>&1; then
|
||||||
if getent hosts "${BACKEND_HOST}" >/dev/null 2>&1; then
|
if getent hosts "${BACKEND_HOST}" >/dev/null 2>&1; then
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Backend host ${BACKEND_HOST} is not resolvable yet."
|
echo "Backend host ${BACKEND_HOST} is not resolvable yet."
|
||||||
return 1
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Alpine-based images may not ship getent. In that case let curl be the
|
||||||
|
# source of truth for connectivity and retry in the main loop on failure.
|
||||||
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
apply_bundle() {
|
apply_bundle() {
|
||||||
|
|||||||
Reference in New Issue
Block a user