feat: backend env config upgrade - multi-env (dev/prod), DB_* support, Docker compatible
Some checks failed
Build and Deploy / test-backend (push) Has been cancelled
Build and Deploy / build-backend (push) Has been cancelled
Build and Deploy / build-admin (push) Has been cancelled
Deploy to Production / build-backend (push) Has been cancelled
Deploy to Production / deploy (push) Has been cancelled

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
bujie9527
2026-02-06 12:07:02 +08:00
parent 91c3d75557
commit b715755b76
11 changed files with 141 additions and 35 deletions

View File

@@ -1,13 +1,16 @@
from pydantic_settings import BaseSettings, SettingsConfigDict
# 数据库 URL 由 config.settings 提供(环境变量优先,支持 DB_* 拼接,容器兼容)
from config.settings import DATABASE_URL, DATABASE_URL_SYNC
class Settings(BaseSettings):
model_config = SettingsConfigDict(env_file=".env", env_file_encoding="utf-8", extra="ignore")
api_host: str = "0.0.0.0"
api_port: int = 8000
database_url: str = "postgresql+asyncpg://wecom:wecom_secret@localhost:5432/wecom_ai"
database_url_sync: str = "postgresql://wecom:wecom_secret@localhost:5432/wecom_ai"
database_url: str = DATABASE_URL
database_url_sync: str = DATABASE_URL_SYNC
jwt_secret: str = "change-me"
jwt_algorithm: str = "HS256"