36 lines
1.1 KiB
Python
36 lines
1.1 KiB
Python
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_PORT: int = Field(default=10090, description='')
|
||
|
||
FLUX2_KLEIN_MODEL_PATH: str = Field(default="/models", 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()
|