import os

from pydantic_settings import BaseSettings, SettingsConfigDict
from pydantic import Field


# ⚠️ 注意: 您需要安装 pydantic-settings: pip install pydantic-settings


class Settings(BaseSettings):
    """
    应用配置类。Pydantic Settings 会自动从环境变量和 .env 文件中加载这些值。
    """
    model_config = SettingsConfigDict(
        env_file='.env',
        env_file_encoding='utf-8',
        extra='ignore'  # 忽略环境变量中多余的键
    )
    # 启动端口
    SERVE_PROD: int = Field(default=8000, description='')
    # minio配置
    MINIO_URL: str = Field(default="", description="URL")
    MINIO_ACCESS: str = Field(default="", description="ACCESS")
    MINIO_SECRET: str = Field(default="", description="SECRET")
    MINIO_SECURE: bool = Field(default=True, description="SECRET")
    MINIO_LC_DATA_PATH: str = Field(default="", description="图片数据路径")


# 创建配置实例，供应用其他部分使用
settings = Settings()
