2026-06-08 13:50:16 -07:00
|
|
|
"""Configuration for the file-storage module, sourced from the central Config."""
|
2026-06-02 16:10:43 +02:00
|
|
|
|
|
|
|
|
from __future__ import annotations
|
|
|
|
|
|
|
|
|
|
from dataclasses import dataclass
|
|
|
|
|
|
|
|
|
|
LOCAL_BACKEND = "local"
|
|
|
|
|
AZURE_BACKEND = "azure"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@dataclass(frozen=True)
|
|
|
|
|
class StorageSettings:
|
|
|
|
|
"""Resolved storage configuration for the current process."""
|
|
|
|
|
|
|
|
|
|
backend: str
|
|
|
|
|
azure_connection_string: str | None
|
|
|
|
|
azure_container: str | None
|
|
|
|
|
local_root: str
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def load_storage_settings() -> StorageSettings:
|
2026-06-08 13:50:16 -07:00
|
|
|
"""Resolve storage settings from the central ``Config`` singleton.
|
2026-06-02 16:10:43 +02:00
|
|
|
|
|
|
|
|
Defaults to the ``local`` backend so development needs no cloud creds.
|
|
|
|
|
"""
|
2026-06-08 13:50:16 -07:00
|
|
|
from app.config import config
|
|
|
|
|
|
2026-06-02 16:10:43 +02:00
|
|
|
return StorageSettings(
|
2026-06-08 13:50:16 -07:00
|
|
|
backend=config.FILE_STORAGE_BACKEND,
|
|
|
|
|
azure_connection_string=config.AZURE_STORAGE_CONNECTION_STRING,
|
|
|
|
|
azure_container=config.AZURE_STORAGE_CONTAINER,
|
|
|
|
|
local_root=config.FILE_STORAGE_LOCAL_PATH,
|
2026-06-02 16:10:43 +02:00
|
|
|
)
|