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()
|