feat: initial MVP - FastAPI backend + Vue3 frontend + docker-compose
- backend: FastAPI + SQLAlchemy 2.0(async) + asyncpg + Alembic - 7 API routes: auth/me/articles/sources/bookmarks/subscriptions/admin - models: User/Source/Article/Bookmark/Subscription/ApiToken - services: RSS fetcher (feedparser) + Tencent TMT translator with quota + cache + local NLLB fallback - workers: APScheduler + asyncio pipeline (fetch -> dedupe -> insert -> translate) - seed scripts: create_user, seed_sources (5 RSS: Reuters/BBC/Al Jazeera/NHK/DW) - frontend: Vue 3 + Vite + Naive UI + Pinia + vue-router - pages: Login, Feed (24h), ArticleDetail, Sources, Bookmarks, AdminSources - deploy: docker-compose (postgres/redis/api/worker/frontend/caddy) - docs: README, DEPLOY, architecture, acceptance
This commit is contained in:
58
.env.example
Normal file
58
.env.example
Normal file
@@ -0,0 +1,58 @@
|
||||
# ===== 通用 =====
|
||||
TZ=Asia/Hong_Kong
|
||||
LOG_LEVEL=INFO
|
||||
|
||||
# ===== 数据库 =====
|
||||
POSTGRES_USER=news
|
||||
POSTGRES_PASSWORD=change_me_strong_password
|
||||
POSTGRES_DB=news
|
||||
POSTGRES_HOST=postgres
|
||||
POSTGRES_PORT=5432
|
||||
|
||||
# ===== Redis =====
|
||||
REDIS_HOST=redis
|
||||
REDIS_PORT=6379
|
||||
REDIS_PASSWORD=change_me_redis_password
|
||||
REDIS_DB=0
|
||||
|
||||
# ===== JWT =====
|
||||
# openssl rand -hex 64 生成
|
||||
JWT_SECRET=change_me_to_a_64byte_random_hex
|
||||
JWT_ALGORITHM=HS256
|
||||
ACCESS_TOKEN_TTL_MIN=60
|
||||
REFRESH_TOKEN_TTL_DAY=14
|
||||
|
||||
# ===== 腾讯云 TMT 翻译 =====
|
||||
# https://console.cloud.tencent.com/cam/capi 申请
|
||||
TENCENTCLOUD_SECRET_ID=your_tencent_secret_id
|
||||
TENCENTCLOUD_SECRET_KEY=your_tencent_secret_key
|
||||
TENCENTCLOUD_REGION=ap-hongkong
|
||||
TENCENT_TMT_ENDPOINT=tmt.tencentcloudapi.com
|
||||
# 字符配额(月度,5000000 = 500 万)
|
||||
TENCENT_TMT_QUOTA_MONTH=5000000
|
||||
# 缓冲比例(0.05 = 95% 触发后切本地)
|
||||
TENCENT_TMT_QUOTA_BUFFER=0.05
|
||||
# 单次请求最大字符
|
||||
TENCENT_TMT_MAX_CHARS_PER_REQ=4500
|
||||
|
||||
# ===== 本地翻译(降级) =====
|
||||
# 不启用就留空:不会用本地模型
|
||||
LOCAL_TRANSLATE_ENABLED=false
|
||||
LOCAL_TRANSLATE_MODEL=nllb-200-distilled-600M
|
||||
LOCAL_TRANSLATE_DEVICE=cpu
|
||||
|
||||
# ===== 抓取 =====
|
||||
# 全局 QPS 上限
|
||||
FETCH_GLOBAL_QPS=4
|
||||
# 单源超时(秒)
|
||||
FETCH_TIMEOUT=20
|
||||
# 单源失败连续次数后暂停
|
||||
FETCH_FAIL_PAUSE_THRESHOLD=3
|
||||
# 单源 fetch 最大重试次数
|
||||
FETCH_MAX_RETRIES=2
|
||||
|
||||
# ===== Caddy / 域名 =====
|
||||
# 留空走 IP 自签证书;有域名走自动 HTTPS
|
||||
DOMAIN=
|
||||
# 邮箱(Let's Encrypt 用)
|
||||
ACME_EMAIL=you@example.com
|
||||
Reference in New Issue
Block a user