47 lines
1.2 KiB
Python
47 lines
1.2 KiB
Python
"""
|
|
PaperJet backend configuration.
|
|
|
|
All settings are driven by environment variables (see .env.example).
|
|
"""
|
|
|
|
from pathlib import Path
|
|
from pydantic_settings import BaseSettings
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
"""Application settings loaded from environment variables."""
|
|
|
|
# --- Security ---
|
|
SECRET_KEY: str = "change-me-in-production"
|
|
|
|
# --- Upload ---
|
|
MAX_UPLOAD_MB: int = 200
|
|
|
|
# --- Retention ---
|
|
TRASH_RETENTION_DAYS: int = 30
|
|
AUTO_VERSION_RETENTION_DAYS: int = 30
|
|
|
|
# --- Cookie ---
|
|
COOKIE_SECURE: bool = False # Set True in production (behind HTTPS proxy)
|
|
COOKIE_MAX_AGE_SECONDS: int = 7 * 24 * 60 * 60 # 7 days
|
|
COOKIE_NAME: str = "paperjet_session"
|
|
|
|
# --- Database ---
|
|
DATABASE_PATH: Path = Path("/data/db/app.sqlite")
|
|
|
|
# --- Storage ---
|
|
PDF_STORAGE_PATH: Path = Path("/data/pdfs")
|
|
THUMBNAILS_PATH: Path = Path("/data/thumbnails")
|
|
|
|
# --- App ---
|
|
APP_VERSION: str = "0.1.0"
|
|
DEBUG: bool = False
|
|
|
|
# --- Rate Limiting ---
|
|
LOGIN_MAX_ATTEMPTS: int = 5
|
|
LOGIN_LOCKOUT_SECONDS: int = 900 # 15 minutes
|
|
|
|
model_config = {"env_prefix": "PAPERJET_", "env_file": ".env", "extra": "ignore"}
|
|
|
|
|
|
settings = Settings()
|