Change from logging intention to actually enacting command

This commit is contained in:
Jack Jackson 2022-08-19 17:01:26 -07:00
parent 48993f0e4d
commit 95687b2177

View File

@ -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