Files
WeReadBoard/start_dashboard.sh
T

35 lines
1.2 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
# ==========================================================================
# 阅间 · 微信读书看板 —— 启动脚本
# --------------------------------------------------------------------------
# 用法:
# ./start_dashboard.sh # 默认 8770 端口
# PORT=8080 ./start_dashboard.sh # 指定端口(注意 8080 可能被旧实例占用)
#
# 需要设置 WEREAD_API_KEY;MySQL 不可用时服务仍会启动(部分功能降级)。
# ==========================================================================
set -euo pipefail
cd "$(dirname "$0")"
PROJECT_PYTHON="$(pwd)/.venv/bin/python"
PYTHON_BIN="${PYTHON_BIN:-$PROJECT_PYTHON}"
if [ ! -x "$PYTHON_BIN" ]; then
PYTHON_BIN="$HOME/.workbuddy/binaries/python/envs/default/bin/python"
fi
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