feat(server): 统一配置文件管理并增强环境变量配置

- 将服务器配置文件合并到根目录的 .env.example 中,移除 server/.env.example
- 为 PostgreSQL、Redis、MinIO/S3、Server、前端构建和Nginx 配置添加详细注释
- 新增 S3_REGION、S3_PUBLIC_URL 和 SENTRY_DSN 环境变量配置
- 修改配置加载逻辑以正确读取根目录下的 .env 文件
- 更新 docker-compose.yml 以包含新增的环境变量
This commit is contained in:
2026-05-09 18:33:33 +08:00
parent 0afd5bbb2c
commit a493d1bcf6
4 changed files with 73 additions and 29 deletions
+11 -1
View File
@@ -1,6 +1,16 @@
from pathlib import Path
from pydantic_settings import BaseSettings
_config_path = Path(__file__).resolve()
_env_file = (
_config_path.parents[3] / ".env"
if _config_path.parents[2].name == "server"
else _config_path.parents[2] / ".env"
)
class Settings(BaseSettings):
DATABASE_URL: str
DATABASE_URL_SYNC: str
@@ -25,7 +35,7 @@ class Settings(BaseSettings):
LOG_LEVEL: str = "INFO"
class Config:
env_file = ".env"
env_file = _env_file
settings = Settings()