You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
buffer_platform/buffer_platform_v2/app/config.py

44 lines
950 B

"""统一配置模块 - 基于 Pydantic Settings"""
from pathlib import Path
from pydantic_settings import BaseSettings
class Settings(BaseSettings):
"""应用全局配置,支持 .env 文件和环境变量覆盖。"""
# Database
database_url: str = "sqlite+aiosqlite:///./data/buffer_v2.db"
# Server
host: str = "0.0.0.0"
port: int = 8600
# Cache
cache_ttl_seconds: int = 300
redis_url: str = "redis://localhost:6379/0"
redis_enabled: bool = True # 是否启用Redis缓存
# Workers
max_workers: int = 2
# Scheduler
scheduler_max_instances: int = 3
# Logging
log_level: str = "INFO"
# JWT
jwt_secret_key: str = "change-me-in-production"
jwt_algorithm: str = "HS256"
jwt_expire_hours: int = 24
# Paths
data_dir: Path = Path("./data")
model_config = {"env_file": ".env", "env_file_encoding": "utf-8", "extra": "ignore"}
settings = Settings()