dify插件初步构建
This commit is contained in:
38
difyPlugin/app/config.py
Normal file
38
difyPlugin/app/config.py
Normal file
@@ -0,0 +1,38 @@
|
||||
"""应用配置管理"""
|
||||
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()
|
||||
Reference in New Issue
Block a user