From 95687b217733e10030c4f3b90e3cf752f8ef889a Mon Sep 17 00:00:00 2001 From: Jack Jackson Date: Fri, 19 Aug 2022 17:01:26 -0700 Subject: [PATCH] Change from logging intention to actually enacting command --- dns_update.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/dns_update.sh b/dns_update.sh index cc040e9..c739aa6 100755 --- a/dns_update.sh +++ b/dns_update.sh @@ -1,5 +1,7 @@ #!/bin/sh +set -eux + # First argument is cloudflared config file # TODO - make this optional, and check standard locations if absent. # Not doing it now because that would require me to remember how to @@ -18,10 +20,11 @@ fi # Second argument is "root domain". # If set, only try to update DNS for names that are subdomains of this domain. # If not set, try to update all names +TUNNEL_NAME=$(yq ".tunnel" $CONFIG_FILE_LOCATION); if [ $# -gt 1 ]; then ROOT_DOMAIN=$2; - yq ".ingress[].hostname | select(. != null) | select (. == \"*$ROOT_DOMAIN\")" $CONFIG_FILE_LOCATION | xargs -I {} echo "Would process {}"; + yq ".ingress[].hostname | select(. != null) | select (. == \"*$ROOT_DOMAIN\")" $CONFIG_FILE_LOCATION | xargs -I {} cloudflared tunnel route dns $TUNNEL_NAME {}; else - yq '.ingress[].hostname | select(. != null)' $CONFIG_FILE_LOCATION | xargs -I {} echo "Would process {}"; + yq '.ingress[].hostname | select(. != null)' $CONFIG_FILE_LOCATION | xargs -I {} cloudflared tunnel route dns $TUNNEL_NAME {}; fi