fix(deploy): an answer file with a space in a value killed the install
tests / pest (push) Successful in 7m2s Details
tests / assets (push) Successful in 19s Details
tests / release (push) Successful in 3s Details

The file is sourced, so ADMIN_NAME=Boban Blaskovic is read as a command and
dies with "Blaskovic: command not found" — naming neither the file nor the
variable — and set -e ends the install there. A display name with a space is
entirely ordinary; the example just happened to use "Administrator", one word,
so nobody hit it.

Found while installing on the live server.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
feat/portal-design tested-20260726-1713-875fd11
nexxo 2026-07-26 18:49:58 +02:00
parent 9352935b88
commit 875fd11982
2 changed files with 19 additions and 1 deletions

View File

@ -15,7 +15,9 @@ WWW_DOMAIN=www.clupilot.com # marketing site
WS_DOMAIN=ws.clupilot.com # websockets (Reverb)
ADMIN_DOMAIN=admin.clupilot.com # operator console — must NOT resolve publicly
ADMIN_EMAIL=
ADMIN_NAME=Administrator
# Quote anything that may contain a space — this file is sourced, so an
# unquoted space is read as a command.
ADMIN_NAME="Administrator"
ADMIN_PASSWORD= # at least 12 characters
# ── Needed before the platform can actually do business ─────────────────────

View File

@ -75,6 +75,22 @@ if [[ -n "${ENV_FILE:-}" ]]; then
[[ "$perms" == "600" || "$perms" == "400" ]] || \
printf '\033[1;33m !\033[0m %s\n' "$ENV_FILE is mode $perms — chmod 600 it."
# The file is SOURCED, so an unquoted value containing a space is read as a
# command: `ADMIN_NAME=Boban Blaskovic` dies with "Blaskovic: command not
# found", which names neither the file nor the variable, and `set -e` ends
# the install right there. A display name with a space is entirely ordinary,
# so say so properly instead.
while IFS= read -r line || [[ -n "$line" ]]; do
case "$line" in ''|'#'*) continue ;; esac
if [[ "$line" =~ ^[A-Za-z_][A-Za-z0-9_]*=[^\"\'][^=]*[[:space:]] ]]; then
die "$ENV_FILE, this line has an unquoted value with a space in it:
${line%%=*}=
Quote it: ${line%%=*}=\"${line#*=}\""
fi
done < "$ENV_FILE"
# shellcheck disable=SC1090 # the path is the whole point of the flag
set -a; . "$ENV_FILE"; set +a
fi