"""
|
配置管理模块
|
"""
|
|
import os
|
from typing import Optional
|
from pydantic_settings import BaseSettings
|
|
|
class Settings(BaseSettings):
|
"""应用配置"""
|
|
# 数据库配置
|
database_url: str = "mysql+pymysql://root:TAI%402019%23Zjun@120.24.39.179:3306/ecloud_dify"
|
|
# Redis配置
|
redis_url: str = "redis://localhost:6379/0"
|
|
# E云管家配置
|
ecloud_base_url: str = "http://your-ecloud-domain.com"
|
ecloud_authorization: str = "your-authorization-token"
|
|
# DifyAI配置
|
dify_base_url: str = "https://api.dify.ai/v1"
|
dify_api_key: str = "your-dify-api-key"
|
|
# 服务配置
|
server_host: str = "0.0.0.0"
|
server_port: int = 8000
|
debug: bool = True
|
|
# 日志配置
|
log_level: str = "INFO"
|
log_file: str = "logs/app.log"
|
|
# 消息处理配置
|
max_retry_count: int = 3
|
retry_delay: int = 5 # 秒
|
queue_timeout: int = 300 # 秒
|
|
class Config:
|
env_file = ".env"
|
env_file_encoding = "utf-8"
|
|
|
# 全局配置实例
|
settings = Settings()
|