#!/usr/bin/env bash set -euo pipefail SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" SKILL_ROOT="$(dirname "$SCRIPT_DIR")" source "$SCRIPT_DIR/_common.sh" : "${ZONE_NAME:=}" : "${HOSTNAME:=}" : "${SERVICE_NAME:=cloudflared-tunnel}" : "${CONFIG_DIR:=$SKILL_ROOT/outputs/config}" main() { local status="$SKILL_ROOT/outputs/status_matrix.json" local ok_tunnel=false ok_dns=false ok_config=false ok_service=false if [[ -f "$CONFIG_DIR/tunnel.json" ]]; then ok_tunnel=true; fi if [[ -f "$CONFIG_DIR/dns_route.json" ]]; then ok_dns=true; fi if [[ -f "$CONFIG_DIR/config.yml" ]]; then ok_config=true; fi if command -v systemctl >/dev/null 2>&1; then if systemctl is-active "$SERVICE_NAME" >/dev/null 2>&1; then ok_service=true; fi fi blockers="[]" if [[ "$ok_tunnel" != "true" ]]; then blockers='["tunnel_not_created"]' elif [[ "$ok_dns" != "true" ]]; then blockers='["dns_route_missing"]' elif [[ "$ok_config" != "true" ]]; then blockers='["config_missing"]' fi cat > "$status" <