1e3dc11d59
feat(test-suite): 新增测试套件模块,包含API测试客户端和测试配置 fix(api): 修复数据库实体和仓库的删除操作返回值 style(api): 统一数据库表名和字段命名 perf(api): 添加缓存注解提升配置查询性能 test(api): 添加H2测试数据库配置支持 chore: 清理旧的测试文件和脚本
75 lines
1.5 KiB
Python
75 lines
1.5 KiB
Python
"""
|
|
配置管理模块
|
|
"""
|
|
|
|
import os
|
|
from typing import Optional
|
|
from pydantic_settings import BaseSettings
|
|
from pydantic import Field
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
"""应用配置"""
|
|
|
|
API_BASE_URL: str = Field(
|
|
default="http://localhost:8084",
|
|
description="API基础URL"
|
|
)
|
|
|
|
DATABASE_HOST: str = Field(
|
|
default="localhost",
|
|
description="数据库主机"
|
|
)
|
|
|
|
DATABASE_PORT: int = Field(
|
|
default=55432,
|
|
description="数据库端口"
|
|
)
|
|
|
|
DATABASE_NAME: str = Field(
|
|
default="manage_system",
|
|
description="数据库名称"
|
|
)
|
|
|
|
DATABASE_USERNAME: str = Field(
|
|
default="postgres",
|
|
description="数据库用户名"
|
|
)
|
|
|
|
DATABASE_PASSWORD: str = Field(
|
|
default="postgres",
|
|
description="数据库密码"
|
|
)
|
|
|
|
TEST_USERNAME: str = Field(
|
|
default="admin",
|
|
description="测试用户名"
|
|
)
|
|
|
|
TEST_PASSWORD: str = Field(
|
|
default="admin123",
|
|
description="测试用户密码"
|
|
)
|
|
|
|
REQUEST_TIMEOUT: int = Field(
|
|
default=30000,
|
|
description="请求超时时间(毫秒)"
|
|
)
|
|
|
|
HEADLESS_BROWSER: bool = Field(
|
|
default=True,
|
|
description="无头浏览器模式"
|
|
)
|
|
|
|
BROWSER_TYPE: str = Field(
|
|
default="chromium",
|
|
description="浏览器类型"
|
|
)
|
|
|
|
class Config:
|
|
env_file = ".env"
|
|
env_file_encoding = "utf-8"
|
|
|
|
|
|
settings = Settings()
|