import os from pathlib import Path from pydantic_settings import BaseSettings BASE_DIR = Path(__file__).resolve().parent.parent.parent class Settings(BaseSettings): PROJECT_NAME: str = "OnEver Drive" VERSION: str = "1.0.0" API_V1_PREFIX: str = "/api" # Environment ENVIRONMENT: str = "development" DEBUG: bool = True # Database: Default to SQLite for seamless local dev & test, configurable to PostgreSQL in production DATABASE_URL: str = f"sqlite+aiosqlite:///{BASE_DIR}/onever_drive.db" # Storage settings STORAGE_ROOT: str = str(BASE_DIR / "storage" / "backups") STORAGE_TEMP_ROOT: str = str(BASE_DIR / "storage" / "temp") # Security SECRET_KEY: str = "onever-drive-super-secret-key-change-in-production-2026" ALGORITHM: str = "HS256" ACCESS_TOKEN_EXPIRE_MINUTES: int = 60 * 24 * 7 # 7 days # Upload & Transfer settings DEFAULT_CHUNK_SIZE: int = 4 * 1024 * 1024 # 4 MB MAX_CHUNK_SIZE: int = 16 * 1024 * 1024 # 16 MB MIN_STABLE_TIME_SECONDS: int = 60 # 60s stability window for locked files # Retention Defaults DEFAULT_RETENTION_DAILY: int = 7 DEFAULT_RETENTION_WEEKLY: int = 4 DEFAULT_RETENTION_MONTHLY: int = 12 model_config = {"env_file": ".env", "extra": "allow"} settings = Settings() # Ensure storage directories exist os.makedirs(settings.STORAGE_ROOT, exist_ok=True) os.makedirs(settings.STORAGE_TEMP_ROOT, exist_ok=True)