fix: harden staging database env validation

This commit is contained in:
Jesse_Chen
2026-07-21 07:45:14 +08:00
parent 10bec0408b
commit 9ff5e6266c
4 changed files with 151 additions and 9 deletions
+2 -2
View File
@@ -43,12 +43,12 @@ fi
definition_count() {
local key="$1"
grep -Ec "^(export[[:space:]]+)?${key}=" "$ENV_FILE" || true
grep -Ec "^[[:space:]]*(export[[:space:]]+)?${key}[[:space:]]*=" "$ENV_FILE" || true
}
environment_value() {
local key="$1"
sed -n -E "s/^(export[[:space:]]+)?${key}=(.*)$/\\2/p" "$ENV_FILE"
sed -n -E "s/^[[:space:]]*(export[[:space:]]+)?${key}[[:space:]]*=[[:space:]]*(.*)$/\\2/p" "$ENV_FILE"
}
require_once_non_empty() {