Fix hedge market quotes via public HTTP and default cloud-server deploy settings.

Avoid load_markets hangs on weak networks; enable login-required sim defaults and document Baota Nginx reverse proxy.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-10-14 10:13:39 +08:00
parent b4d62ea0a6
commit 135cdc13ba
11 changed files with 392 additions and 118 deletions
+13 -3
View File
@@ -4,7 +4,7 @@
- FLASK_SECRET_KEY
- APP_USERNAME=admin / APP_PASSWORD=admin123(仅空时)
- HUB_BRIDGE_TOKEN(仅空时,供后期中控)
- 强制默认模拟盘相关键(仅空/占位时)
- 云服务器测试默认:监听/鉴权/模拟盘(仅空或占位时)
"""
from __future__ import annotations
@@ -57,7 +57,15 @@ def main() -> int:
if not (env_get(lines, "HUB_BRIDGE_TOKEN") or "").strip():
updates["HUB_BRIDGE_TOKEN"] = secrets.token_urlsafe(32)
# CoinOX: 默认模拟盘(仅当未配置或空时写入)
# 云服务器测试默认(仅空时写入;不覆盖用户已改配置)
if not (env_get(lines, "APP_HOST") or "").strip():
updates["APP_HOST"] = "0.0.0.0"
if not (env_get(lines, "APP_PORT") or "").strip():
updates["APP_PORT"] = "5010"
if not (env_get(lines, "APP_DEBUG") or "").strip():
updates["APP_DEBUG"] = "false"
if not (env_get(lines, "APP_AUTH_DISABLED") or "").strip():
updates["APP_AUTH_DISABLED"] = "false"
if not (env_get(lines, "SIM_DEFAULT_MODE") or "").strip():
updates["SIM_DEFAULT_MODE"] = "sim"
if not (env_get(lines, "OKX_OPTIONS_MARGIN_MODE") or "").strip():
@@ -66,6 +74,8 @@ def main() -> int:
updates["EXCHANGE_DISPLAY_NAME"] = "CoinOX"
if not (env_get(lines, "OKX_OPTIONS_ENABLED") or "").strip():
updates["OKX_OPTIONS_ENABLED"] = "true"
if not (env_get(lines, "OKX_TRADE_MODE") or "").strip():
updates["OKX_TRADE_MODE"] = "perp_options"
live = (env_get(lines, "LIVE_TRADING_ENABLED") or "").strip().lower()
if live in ("",):
updates["LIVE_TRADING_ENABLED"] = "false"
@@ -86,7 +96,7 @@ def main() -> int:
return 0
apply_env_updates(env_path, updates)
print(" 已写入初始密钥/账号与模拟盘默认(请尽快修改 APP_PASSWORD)")
print(" 已写入云服务器测试默认(请尽快修改 APP_PASSWORD;公网保持 APP_AUTH_DISABLED=false)")
return 0