chef_agent

This commit is contained in:
2026-09-06 19:25:10 +08:00
parent 8efcd72eb2
commit 86ece1926d
10 changed files with 445 additions and 55 deletions

View File

@@ -94,6 +94,30 @@ class Settings(BaseSettings):
description="是否打印SQL语句"
)
# ---------- 数据库Postgres配置 ----------
POSTGRES_USER: str = Field(
default='postgres',
description="postgres用户名"
)
POSTGRES_PASSWORD: str = Field(
default='123456',
description="postgres密码"
)
POSTGRES_HOST: str = Field(
default='127.0.0.1',
description="postgres主机地址"
)
POSTGRES_PORT: int = Field(
default=5432,
ge=1,
le=65535,
description="postgres端口"
)
POSTGRES_DB: str = Field(
default='postgres',
description="postgres数据库名"
)
# ---------- CORS配置 ----------
ALLOWED_ORIGINS: List[str] = Field(
default=["*"],
@@ -161,6 +185,12 @@ class Settings(BaseSettings):
# 连接url格式mysql+pymysql://user:password@host:port/dbname
return f"mysql+pymysql://{self.MYSQL_USER}:{self.MYSQL_PASSWORD}@{self.MYSQL_HOST}:{self.MYSQL_PORT}/{self.MYSQL_DB}?charset=utf8mb4"
@property
def postgres_url(self) -> str:
"""postgres连接URL"""
# 连接url格式postgresql://postgres:postgres@localhost:5432/postgres?sslmode=disable
return f"postgresql://{self.POSTGRES_USER}:{self.POSTGRES_PASSWORD}@{self.POSTGRES_HOST}:{self.POSTGRES_PORT}/{self.POSTGRES_DB}?sslmode=disable"
@property
def is_production(self) -> bool:
"""是否为生产环境"""