chore: 整合 migration 文件并优化配置

- 整合 18 个分散的 migration 文件为 5 个模块化文件
- settings.py 支持 .env.local 覆盖 .env
- 移除 user schema 中未使用的 country 字段正则
- 更新 profile protocol 文档移除 country 字段
- pyproject.toml 添加 ruff 到 dev 依赖
- 简化 integration test conftest 邮箱 fixture
This commit is contained in:
ZL-Q
2026-04-29 00:37:45 +08:00
parent dab47f0cb3
commit adb2b3bcc3
27 changed files with 787 additions and 2232 deletions
+11 -6
View File
@@ -240,13 +240,18 @@ class AppleIapSettings(BaseModel):
server_notifications_url: str | None = None
def _resolve_env_file() -> str:
def _resolve_env_files() -> list[str]:
"""Resolve env files in order: .env.local overrides .env"""
current = Path(__file__).resolve()
for parent in [current, *current.parents]:
candidate = parent / ".env"
if candidate.is_file():
return str(candidate)
return ".env"
env_file = parent / ".env"
if env_file.is_file():
files = [str(env_file)]
env_local = parent / ".env.local"
if env_local.is_file():
files.append(str(env_local))
return files
return [".env"]
PROJECT_ROOT = _resolve_project_root()
@@ -305,7 +310,7 @@ class Settings(BaseSettings):
return self.taskiq.result_backend_url or self.redis.url
model_config: ClassVar[SettingsConfigDict] = SettingsConfigDict(
env_file=_resolve_env_file(),
env_file=_resolve_env_files(),
env_prefix="ERYAO_",
env_nested_delimiter="__",
case_sensitive=False,