fix(simon): preserve bcrypt form value on upgrade

This commit is contained in:
okxlin
2026-10-26 17:50:17 +08:00
parent efd598f76b
commit fa1e4e3d11
+14 -5
View File
@@ -9,10 +9,8 @@ fail() {
exit 1
}
read_env_value() {
local key="$1"
local value=""
value="$(sed -n "s/^${key}=//p" "$ENV_FILE" | tail -n 1)"
unquote_value() {
local value="$1"
case "$value" in
\"*\") value="${value#\"}"; value="${value%\"}" ;;
\'*\') value="${value#\'}"; value="${value%\'}" ;;
@@ -20,10 +18,21 @@ read_env_value() {
printf '%s\n' "$value"
}
read_env_value() {
local key="$1"
local value=""
value="$(sed -n "s/^${key}=//p" "$ENV_FILE" | tail -n 1)"
unquote_value "$value"
}
effective_value() {
local key="$1"
local value=""
if [[ -v "$key" ]]; then
printf '%s\n' "${!key}"
value="${!key}"
fi
if [[ -n "$value" ]]; then
unquote_value "$value"
else
read_env_value "$key"
fi