#!/bin/bash # shellcheck disable=SC1091 source "${AGENT_PATH}/common.sh" _check_required_env_vars "CONTAINER_NAME" echo "Uninstalling Cloudflare Tunnel..." # Stop the container if running if _is_container_running "$CONTAINER_NAME"; then echo "Stopping container $CONTAINER_NAME..." _stop_container "$CONTAINER_NAME" || echo "Warning: Failed to stop container" fi # Remove the container if _is_container_exists "$CONTAINER_NAME"; then echo "Removing container $CONTAINER_NAME..." _remove_container "$CONTAINER_NAME" || _die "Failed to remove container" fi echo "" echo "Cloudflare Tunnel has been uninstalled." echo "" echo "Note: The tunnel configuration in your Cloudflare dashboard remains intact." echo "You can reinstall anytime using the same TUNNEL_TOKEN." echo "" echo "To completely remove the tunnel, delete it from:" echo "https://one.dash.cloudflare.com/ -> Zero Trust -> Access -> Tunnels"