feat(*): 添加测试项目代码
This commit is contained in:
25
config.py
Normal file
25
config.py
Normal file
@@ -0,0 +1,25 @@
|
||||
"""项目配置:所有值从环境变量读取,未配置时使用安全默认值。"""
|
||||
|
||||
import os
|
||||
import uuid
|
||||
from pathlib import Path
|
||||
|
||||
# ── 鉴权 ────────────────────────────────────────────────────
|
||||
WEBHOOK_API_KEY: str = os.environ.get("WEBHOOK_API_KEY", "") or uuid.uuid4().hex
|
||||
|
||||
# ── 网络 ─────────────────────────────────────────────────────
|
||||
HOST: str = os.environ.get("WEBHOOK_HOST", "0.0.0.0")
|
||||
PORT: int = int(os.environ.get("WEBHOOK_PORT", "8081"))
|
||||
|
||||
# ── 上传 ─────────────────────────────────────────────────────
|
||||
UPLOAD_DIR: Path = Path(os.environ.get("UPLOAD_DIR", str(Path(__file__).parent / "uploads")))
|
||||
# 单个文件最大 20 MB
|
||||
MAX_UPLOAD_SIZE: int = int(os.environ.get("MAX_UPLOAD_SIZE", str(20 * 1024 * 1024)))
|
||||
# 允许的文件扩展名(小写,不含点),为空则不限制
|
||||
ALLOWED_EXTENSIONS: set[str] = set(
|
||||
filter(None, os.environ.get("ALLOWED_EXTENSIONS", "").lower().split(","))
|
||||
)
|
||||
|
||||
# ── QQ API ───────────────────────────────────────────────────
|
||||
QQ_API_TIMEOUT: float = float(os.environ.get("QQ_API_TIMEOUT", "10"))
|
||||
QQ_API_MAX_RETRIES: int = int(os.environ.get("QQ_API_MAX_RETRIES", "2"))
|
||||
Reference in New Issue
Block a user