diff --git a/backend/config.py b/backend/config.py index 7c53f25..0d67f5e 100644 --- a/backend/config.py +++ b/backend/config.py @@ -2,6 +2,47 @@ import json import os from pathlib import Path +from pydantic_settings import BaseSettings, SettingsConfigDict + + +class Settings(BaseSettings): + """Phase 1 Pydantic Settings — reads all Phase 1 env vars from environment or .env file.""" + + model_config = SettingsConfigDict( + env_file=".env", + env_file_encoding="utf-8", + extra="ignore", + ) + + # Data directory (legacy flat-file path — kept until Plan 05 removes it) + data_dir: str = "/app/data" + + # PostgreSQL + database_url: str = "postgresql+psycopg://docuvault_app:changeme_app@postgres:5432/docuvault" + database_migrate_url: str = "postgresql+psycopg://docuvault_migrate:changeme_migrate@postgres:5432/docuvault" + + # MinIO + minio_endpoint: str = "minio:9000" + minio_access_key: str = "docuvault_app" + minio_secret_key: str = "changeme_minio_app" + minio_bucket: str = "docuvault" + + # Redis / Celery + redis_url: str = "redis://:changeme_redis@redis:6379/0" + + # Security (Phase 2 — documented now, not read by Phase 1 code paths) + secret_key: str = "CHANGEME" + + +settings = Settings() + +# ────────────────────────────────────────────────────────────────────────────── +# Legacy flat-file constants — kept for backward compatibility through Wave 4. +# These are consumed by services/storage.py, services/classifier.py, and +# api/settings.py until Plan 05 rewrites those modules. +# DO NOT DELETE until Plan 05 completes the storage service cutover. +# ────────────────────────────────────────────────────────────────────────────── + DATA_DIR = Path(os.environ.get("DATA_DIR", "/app/data")) UPLOADS_DIR = DATA_DIR / "uploads" METADATA_DIR = DATA_DIR / "metadata" diff --git a/backend/requirements.txt b/backend/requirements.txt index 89beb1b..acfa8c6 100644 --- a/backend/requirements.txt +++ b/backend/requirements.txt @@ -8,8 +8,14 @@ PyMuPDF>=1.24 python-docx>=1.1 pytesseract>=0.3 Pillow>=10.3 -filelock>=3.14 aiofiles>=23.2 httpx>=0.27 pytest>=8.2 -pytest-asyncio>=0.23 +pytest-asyncio>=1.3.0 +sqlalchemy[asyncio]>=2.0.49 +psycopg[binary]>=3.3.4 +alembic>=1.18.4 +minio>=7.2.20 +celery[redis]>=5.6.3 +redis>=7.4.0 +aiosqlite>=0.20.0