fix: prevent install.sh crash when .env exists without expected keys

The env_val() function uses grep which returns exit code 1 when no
match is found. Under set -euo pipefail, this kills the script.
Adding || true prevents this on upgrade installs with older .env files.
This commit is contained in:
Jannis Braun
2026-03-03 23:32:28 +01:00
parent fd175023c1
commit 9ae9a0f3dc
+3 -2
View File
@@ -141,10 +141,11 @@ if [[ -f .env ]]; then
info "Existing .env detected — secrets will be preserved."
fi
# Helper: read existing .env value
# Helper: read existing .env value (|| true prevents set -e from killing
# the script when grep finds no match and returns exit code 1)
env_val() {
if [[ -f .env ]]; then
grep "^${1}=" .env 2>/dev/null | head -1 | cut -d= -f2-
grep "^${1}=" .env 2>/dev/null | head -1 | cut -d= -f2- || true
fi
}