Files
urbanLifeline/difyPlugin/app/config.py

39 lines
815 B
Python
Raw Normal View History

2025-12-30 13:38:32 +08:00
"""应用配置管理"""
from pydantic_settings import BaseSettings
from functools import lru_cache
class Settings(BaseSettings):
"""应用配置"""
# 应用基础配置
APP_NAME: str = "DifyPlugin"
APP_VERSION: str = "1.0.0"
DEBUG: bool = False
# API配置
API_V1_PREFIX: str = "/api/v1"
HOST: str = "0.0.0.0"
API_HOST: str = "localhost" # OpenAPI servers 显示的地址
PORT: int = 8380
# 跨域配置
CORS_ORIGINS: list[str] = ["*"]
# Redis配置
REDIS_HOST: str = "localhost"
REDIS_PORT: int = 6379
REDIS_PASSWORD: str = "123456"
REDIS_DB: int = 0
class Config:
env_file = ".env"
case_sensitive = True
@lru_cache()
def get_settings() -> Settings:
return Settings()
settings = get_settings()