Files
WeReadBoard/start_dashboard.sh
T
admin 4cbaabd42c chore: 新增 v2 看板启动脚本 start_dashboard.sh
封装启动流程,支持 PORT / WEREAD_API_KEY / PYTHON_BIN 环境变量。
默认使用托管 Python 环境,避免系统解释器缺少 flask 依赖。
2026-09-11 18:21:13 +08:00

31 lines
1.1 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/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