mirror of
https://github.com/okxlin/appstore.git
synced 2026-11-22 00:00:30 +00:00
Add an optional editable CORS origin list for latest and http-meta, propagate it through Compose, and backfill only missing upgrade configuration keys. Document the installed Compose mapping needed before a same-tag rebuild. Verified with eight real 1Panel v2.3.2 API scenarios and focused HTTP, data, configuration and documentation checks. The complete app tree and runtime image identities match the tested repair.
38 lines
1.1 KiB
Bash
Executable File
38 lines
1.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
ROOT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
|
|
ENV_FILE="${ENV_FILE:-${ROOT_DIR}/.env}"
|
|
|
|
get_env_value() {
|
|
local key="$1"
|
|
local value=""
|
|
|
|
if [[ -f "$ENV_FILE" ]]; then
|
|
value="$(sed -n -E "s/^${key}=//p" "$ENV_FILE" | tail -n 1 || true)"
|
|
value="${value%\"}"
|
|
value="${value#\"}"
|
|
value="${value%\'}"
|
|
value="${value#\'}"
|
|
fi
|
|
|
|
printf '%s\n' "$value"
|
|
}
|
|
|
|
if [[ -f "$ENV_FILE" ]] && ! grep -q '^SUB_STORE_BACKEND_SYNC_CRON=' "$ENV_FILE"; then
|
|
legacy_cron="$(get_env_value SUB_STORE_CRON)"
|
|
if [[ -z "$legacy_cron" ]]; then
|
|
legacy_cron="$(get_env_value SUB_STORE_BACKEND_CRON)"
|
|
fi
|
|
if [[ -n "$legacy_cron" ]]; then
|
|
printf '\nSUB_STORE_BACKEND_SYNC_CRON="%s"\n' "$legacy_cron" >> "$ENV_FILE"
|
|
echo "Migrated legacy Sub-Store cron to SUB_STORE_BACKEND_SYNC_CRON."
|
|
fi
|
|
fi
|
|
|
|
if [[ -f "$ENV_FILE" ]] && ! grep -Eq '^[[:space:]]*(export[[:space:]]+)?SUB_STORE_CORS_ALLOWED_ORIGINS[[:space:]]*=' "$ENV_FILE"; then
|
|
printf '\nSUB_STORE_CORS_ALLOWED_ORIGINS=""\n' >> "$ENV_FILE"
|
|
fi
|
|
|
|
echo "Sub-Store upgrade preflight completed."
|