24 lines
747 B
Python
24 lines
747 B
Python
"""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()
|