mirror of
https://github.com/KingHWJ/WeReadBoard.git
synced 2026-11-03 18:24:58 +08:00
chore: 新增 v2 看板启动脚本 start_dashboard.sh
封装启动流程,支持 PORT / WEREAD_API_KEY / PYTHON_BIN 环境变量。 默认使用托管 Python 环境,避免系统解释器缺少 flask 依赖。
This commit is contained in:
1 parent
25293a1d50
commit
4cbaabd42c
1 file changed
+30
Executable
+30
@@ -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
|
||||||
Reference in new issue
Block a user