This commit is contained in:
Your Name
2026-07-23 17:56:25 +08:00
parent a05dae8412
commit 4970d8f8d3
4262 changed files with 735221 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
"""应用配置:支持本地开发与 Linux/宝塔 Web 部署。"""
import os
from pathlib import Path
BACKEND_DIR = Path(__file__).resolve().parent
PROJECT_ROOT = BACKEND_DIR.parent
# 前端构建产物目录(npm run build 输出)
STATIC_DIR = Path(os.getenv("KEFU_STATIC_DIR", PROJECT_ROOT / "frontend" / "dist"))
HOST = os.getenv("KEFU_HOST", "0.0.0.0")
PORT = int(os.getenv("KEFU_PORT", "8000"))
# 是否由 FastAPI 托管前端静态文件(单端口 Web 访问)
SERVE_WEB = os.getenv("KEFU_SERVE_WEB", "true").lower() in ("1", "true", "yes")
# CORS:同域部署用默认即可;前后端分离时设置 KEFU_CORS_ORIGINS=https://your.domain
_cors_raw = os.getenv("KEFU_CORS_ORIGINS", "*").strip()
CORS_ORIGINS: list[str] = (
["*"] if _cors_raw == "*" else [o.strip() for o in _cors_raw.split(",") if o.strip()]
)