feat: add document artifact model, migration, and storage root config

This commit is contained in:
Арсентьев Александр
2026-09-29 15:29:45 +03:00
parent 11758a33e9
commit adc92e3460
9 changed files with 1378 additions and 0 deletions
+23
View File
@@ -0,0 +1,23 @@
"""Application configuration.
Storage root for generated document artifacts. The default is anchored to the
application package directory, not the process working directory.
"""
from __future__ import annotations
import os
from pathlib import Path
# <app>/../storage — project-level storage directory.
APP_DIR = Path(__file__).resolve().parent
_DEFAULT_STORAGE_ROOT = APP_DIR.parent / "storage"
ENV_DOCUMENT_STORAGE_ROOT = "DOCUMENT_STORAGE_ROOT"
def document_storage_root() -> Path:
"""Return the document artifact storage root without creating it."""
override = os.environ.get(ENV_DOCUMENT_STORAGE_ROOT, "").strip()
if override:
return Path(override).expanduser().resolve()
return _DEFAULT_STORAGE_ROOT.resolve()