Skip to content

Commit

Permalink
Do not exit on fetch failure
Browse files Browse the repository at this point in the history
  • Loading branch information
dappnodedev committed Dec 20, 2023
1 parent 536eb68 commit c81c47d
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions bind/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,17 @@ fetch_env() {
sleep $wait_time
done

echo "Error: Failed to fetch $env_var_name after $retries attempts."
echo " [ERROR] Failed to fetch $env_var_name after $retries attempts."
return 1
}

# Start DNS server in background right away
/app/dnscrypt-proxy &

# Initialize domain and internal_ip variables
domain=""
internal_ip=""

pid=$!

# Fetch required environment variables
Expand All @@ -39,9 +43,7 @@ else
if [ $? -eq 0 ]; then
domain=$fetched_domain
else
echo "Failed to fetch DOMAIN"
kill $pid
exit 1
echo "[ERROR] Failed to fetch DOMAIN"
fi
fi

Expand All @@ -54,15 +56,18 @@ else
if [ $? -eq 0 ]; then
internal_ip=$fetched_internal_ip
else
echo "Failed to fetch INTERNAL_IP"
kill $pid
exit 1
echo "[ERROR] Failed to fetch INTERNAL_IP"
fi
fi

echo "$domain $internal_ip" >cloaking-rules.txt
# Only write to cloaking-rules.txt if both domain and internal_ip are available
if [ -n "$domain" ] && [ -n "$internal_ip" ]; then
echo "$domain $internal_ip" >cloaking-rules.txt

kill $pid
wait $pid
kill $pid
wait $pid

/app/dnscrypt-proxy
/app/dnscrypt-proxy
else
echo "[ERROR] Missing domain or internal IP. Cloaking rules not updated. Dyndns domain will not be forwarded to internal IP."
fi

0 comments on commit c81c47d

Please sign in to comment.