Files
AiDA_Model_Litserve/app/config/config.py
2026-01-26 10:16:47 +08:00

33 lines
1.0 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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='')
# 调试配饰
LOCAL: int = Field(default=0, description="是否在本地运行1表示本地运行0表示生产环境运行")
# 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")
# 创建配置实例,供应用其他部分使用
settings = Settings()