Update start.sh

This commit is contained in:
wnlen
2026-01-15 17:27:32 +08:00
parent 679218504a
commit be8977e0e3

View File

@ -56,12 +56,13 @@ if is_running; then
exit 0 exit 0
fi fi
# 将 CLASH_URL 变量的值赋给 URL 变量,并检查 CLASH_URL 是否为空 # 统一订阅变量
# systemd 模式:允许为空(用兜底配置启动)
if [ "$SYSTEMD_MODE" = "true" ]; then
URL="${CLASH_URL:-}" URL="${CLASH_URL:-}"
else
URL="${CLASH_URL:?Error: CLASH_URL variable is not set or empty}" # 只有在“需要在线更新订阅”的模式下才强制要求 URL
if [ -z "$URL" ] && [ "${SYSTEMD_MODE:-false}" != "true" ]; then
echo "[ERR] CLASH_URL 为空(未配置订阅地址)"
exit 2
fi fi
# 获取 CLASH_SECRET 值:优先 .env其次读取旧 config占位符视为无效最后生成随机值 # 获取 CLASH_SECRET 值:优先 .env其次读取旧 config占位符视为无效最后生成随机值