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:
+3
-2
@@ -141,10 +141,11 @@ if [[ -f .env ]]; then
|
|||||||
info "Existing .env detected — secrets will be preserved."
|
info "Existing .env detected — secrets will be preserved."
|
||||||
fi
|
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() {
|
env_val() {
|
||||||
if [[ -f .env ]]; then
|
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
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user