From e14d0d4ca4b91de19fb2ae148a14a5607c7fedec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Petazzoni?= Date: Mon, 8 May 2023 21:50:05 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20Tweak=20netlify=20DNS=20script?= =?UTF-8?q?=20to=20take=20domain=20as=20env=20var?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Now that script can be used for container.training, but also our other properties at Netlify (e.g. tinyshellscript.com) --- prepare-labs/netlify-dns.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/prepare-labs/netlify-dns.sh b/prepare-labs/netlify-dns.sh index d2fe0e56..b4846445 100755 --- a/prepare-labs/netlify-dns.sh +++ b/prepare-labs/netlify-dns.sh @@ -18,6 +18,9 @@ } NETLIFY_CONFIG_FILE=~/.config/netlify/config.json +if ! [ "$DOMAIN" ]; then + DOMAIN=container.training +fi if ! [ -f "$NETLIFY_CONFIG_FILE" ]; then echo "Could not find Netlify configuration file ($NETLIFY_CONFIG_FILE)." @@ -42,7 +45,7 @@ netlify() { } ZONE_ID=$(netlify dns_zones | - jq -r '.[] | select ( .name == "container.training" ) | .id') + jq -r '.[] | select ( .name == "'$DOMAIN'" ) | .id') _list() { netlify dns_zones/$ZONE_ID/dns_records | @@ -50,7 +53,7 @@ _list() { } _add() { - NAME=$1.container.training + NAME=$1.$DOMAIN ADDR=$2