settings.py 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. from pathlib import Path
  2. from typing import Any
  3. from pydantic import BaseModel
  4. from pydantic_settings import BaseSettings
  5. class LogConfig(BaseModel):
  6. datetime_format: str = "%Y-%m-%d %H:%M:%S"
  7. LOG_LEVEL: str = "DEBUG" # 修改日志级别为 DEBUG
  8. LOG_DIR: Path = ''
  9. class Settings(BaseSettings):
  10. # 基础配置
  11. BASE_DIR: Path = Path(__file__).parent.parent.absolute()
  12. OUTPUT_DIR: Path = BASE_DIR / "output"
  13. APP_NAME: str = "proxy-pool"
  14. DEBUG: bool = True
  15. HOST: str = "0.0.0.0"
  16. PORT: int = 5010
  17. WORKERS: int = 1
  18. LOG_CONF: LogConfig = LogConfig(LOG_DIR = Path(OUTPUT_DIR / "logs"))
  19. SUBSCRIPTION_USER_AGENT: str = "clash-verge/v1.7.5"
  20. # mihomo 配置
  21. MIHOMO_BIN_PATH: Path = BASE_DIR / r"output\download\mihomo\mihomo-windows-amd64-go120.exe"
  22. MIHOMO_TEMP_PATH: Path = OUTPUT_DIR / "temp"
  23. MIHOMO_DOWNLOAD_URL: str = "https://github.com/MetaCubeX/mihomo/releases/download/v1.18.6/mihomo-windows-amd64-go120-v1.18.6.zip"
  24. # 路径配置
  25. PATH_CONFIG_DIR: Path = BASE_DIR / "output/configs"
  26. PATH_SUBSCRIPTION_DIR: Path = BASE_DIR / "output/subscriptions"
  27. APP_CONFIG:Path = BASE_DIR / "config/app.yaml"
  28. class Config:
  29. case_sensitive = True
  30. settings = Settings()