from pydantic_settings import BaseSettings from typing import Optional class Settings(BaseSettings): # 应用配置 APP_NAME: str = "IPAM Management System" APP_VERSION: str = "0.1.0" DEBUG: bool = True # 数据库配置 DATABASE_URL: str = "mysql+pymysql://ipam:***@localhost:3308/ipam" # Redis配置 REDIS_URL: str = "redis://localhost:6379/0" # Celery配置 CELERY_BROKER_URL: str = "redis://localhost:6379/1" CELERY_RESULT_BACKEND: str = "redis://localhost:6379/2" # JWT配置 SECRET_KEY: str = "your-super-secret-key-here-change-in-production" ALGORITHM: str = "HS256" ACCESS_TOKEN_EXPIRE_MINUTES: int = 60 * 24 * 7 # 扫描配置 PING_TIMEOUT: int = 2 PING_RETRIES: int = 2 SCAN_CONCURRENCY: int = 50 class Config: env_file = ".env" settings = Settings()