From 4cbaabd42cea1720406780241dded398115e49c0 Mon Sep 17 00:00:00 2001 From: kinghwj Date: Fri, 11 Sep 2026 18:21:13 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E6=96=B0=E5=A2=9E=20v2=20=E7=9C=8B?= =?UTF-8?q?=E6=9D=BF=E5=90=AF=E5=8A=A8=E8=84=9A=E6=9C=AC=20start=5Fdashboa?= =?UTF-8?q?rd.sh?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 封装启动流程,支持 PORT / WEREAD_API_KEY / PYTHON_BIN 环境变量。 默认使用托管 Python 环境,避免系统解释器缺少 flask 依赖。 --- start_dashboard.sh | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100755 start_dashboard.sh 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