DocumentVault / server /storage /factory.py
mohsin-devs's picture
Deploy HF-ready DocVault with HF storage backend
2fe2727
raw
history blame contribute delete
622 Bytes
"""Storage backend factory."""
from server import config
from server.storage.hf import HuggingFaceStorageManager
_storage_instance = None
def get_storage() -> HuggingFaceStorageManager:
"""Return the configured singleton storage backend."""
global _storage_instance
if config.STORAGE_MODE != config.HF_STORAGE_LABEL:
raise RuntimeError(
f"Unsupported STORAGE_MODE '{config.STORAGE_MODE}'. "
"Local storage is disabled. Set STORAGE_MODE=HF."
)
if _storage_instance is None:
_storage_instance = HuggingFaceStorageManager()
return _storage_instance