diff --git a/start_dashboard.sh b/start_dashboard.sh new file mode 100755 index 0000000..e06b743 --- /dev/null +++ b/start_dashboard.sh @@ -0,0 +1,30 @@ +#!/usr/bin/env bash +# ========================================================================== +# 阅间 · 微信读书看板 v2 —— 启动脚本 +# -------------------------------------------------------------------------- +# 用法: +# ./start_dashboard.sh # 默认 8770 端口 +# PORT=8080 ./start_dashboard.sh # 指定端口(注意 8080 可能被旧实例占用) +# +# 需要设置 WEREAD_API_KEY;MySQL 不可用时服务仍会启动(部分功能降级)。 +# ========================================================================== +set -euo pipefail + +cd "$(dirname "$0")" + +PYTHON_BIN="${PYTHON_BIN:-$HOME/.workbuddy/binaries/python/envs/default/bin/python}" +if [ ! -x "$PYTHON_BIN" ]; then + PYTHON_BIN="$(command -v python3)" +fi + +export WEREAD_API_KEY="${WEREAD_API_KEY:-}" +export PORT="${PORT:-8770}" + +if [ -z "$WEREAD_API_KEY" ]; then + echo "[警告] WEREAD_API_KEY 未设置,书籍详情 / 笔记 / 推荐 / 搜索等实时接口将不可用" + echo " export WEREAD_API_KEY=wrk-xxxxxxxx" +fi + +echo "[信息] Python: $PYTHON_BIN" +echo "[信息] 启动端口: $PORT" +exec "$PYTHON_BIN" app.py