From 1ae90725d64a4fb7bfe16895c5e5c8e1a3964c14 Mon Sep 17 00:00:00 2001 From: Brian Zalewski <59970525+ProfessorManhattan@users.noreply.github.com> Date: Sat, 18 May 2024 05:13:13 +0000 Subject: [PATCH] Added null protection --- .../bin/post-installx/executable_post-cloudflared.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/home/dot_local/bin/post-installx/executable_post-cloudflared.sh b/home/dot_local/bin/post-installx/executable_post-cloudflared.sh index 69131539..6c379ccb 100644 --- a/home/dot_local/bin/post-installx/executable_post-cloudflared.sh +++ b/home/dot_local/bin/post-installx/executable_post-cloudflared.sh @@ -56,8 +56,10 @@ if command -v cloudflared > /dev/null; then # Must be deleted manually if no longer used logg info 'Setting up DNS records for CloudFlare Argo tunnels' while read DOMAIN; do - logg info "Setting up $DOMAIN for access through cloudflared" - sudo cloudflared tunnel route dns -f "$TUNNEL_ID" "$DOMAIN" && logg success "Successfully routed $DOMAIN to this machine's cloudflared Argo tunnel" + if [ "$DOMAIN" != 'null' ]; then + logg info "Setting up $DOMAIN for access through cloudflared" + sudo cloudflared tunnel route dns -f "$TUNNEL_ID" "$DOMAIN" && logg success "Successfully routed $DOMAIN to this machine's cloudflared Argo tunnel" + fi done< <(yq '.ingress[].hostname' /usr/local/etc/config.yml) ### Update config.yml @@ -79,6 +81,7 @@ if command -v cloudflared > /dev/null; then logg info 'Unloading previous com.cloudflare.cloudflared configuration' sudo launchctl unload /Library/LaunchDaemons/com.cloudflare.cloudflared.plist fi + logg info 'Starting up com.cloudflare.cloudflared configuration' sudo launchctl load -w /Library/LaunchDaemons/com.cloudflare.cloudflared.plist elif [ -f /etc/os-release ]; then ### Linux