From f400be76c62b63f0d0b026094350451376b3b6f9 Mon Sep 17 00:00:00 2001 From: Frank Date: Sun, 23 Aug 2026 15:25:53 -0700 Subject: [PATCH] deploy: make the Caddy hash grep defensive under set -e A missing CADDY_*_HASH in the .env made the 'grep | tail | cut' pipeline return non-zero, which aborted the deploy under 'set -e' before it could warn and keep the placeholder. Add '|| true' so an absent hash warns instead of aborting. (The homepage deploy aborted here because CADDY_ADMIN_HASH was not in the repo-root .env the deploy reads.) --- scripts/deploy.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/deploy.sh b/scripts/deploy.sh index f317b78..d64edd0 100755 --- a/scripts/deploy.sh +++ b/scripts/deploy.sh @@ -163,8 +163,9 @@ if [ '${COPY_SHARED[$TARGET]}' = '1' ]; then echo ' Rendering Caddyfile (basicauth hashes from .env)...' # Extract the hashes with grep/cut rather than sourcing .env: sourcing a # bcrypt value in a set -u shell dies on its dollar-sign expansion. - CADDY_BASICAUTH_HASH=\"\$(grep -E '^CADDY_BASICAUTH_HASH=' .env | tail -1 | cut -d= -f2-)\" - CADDY_ADMIN_HASH=\"\$(grep -E '^CADDY_ADMIN_HASH=' .env | tail -1 | cut -d= -f2-)\" + # '|| true' so a missing hash warns below instead of aborting under set -e. + CADDY_BASICAUTH_HASH=\"\$(grep -E '^CADDY_BASICAUTH_HASH=' .env 2>/dev/null | tail -1 | cut -d= -f2- || true)\" + CADDY_ADMIN_HASH=\"\$(grep -E '^CADDY_ADMIN_HASH=' .env 2>/dev/null | tail -1 | cut -d= -f2- || true)\" if [ -n \"\${CADDY_BASICAUTH_HASH}\" ] && [ -n \"\${CADDY_ADMIN_HASH}\" ]; then # '|' delimiter: the bcrypt hash contains '/' characters. mkdir -p /home/dank/Containers/caddy