mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-06-10 20:35:17 +02:00
- Replaced environment variable usage with a centralized configuration system in multiple modules, including `celery_app`, `agent_cache_store`, `sandbox`, `file_storage`, and `connector_service`. - Enhanced maintainability and readability by sourcing configuration values from the `config` module instead of directly from environment variables. - Updated relevant settings to ensure consistent access to configuration values across the application.
33 lines
925 B
Python
33 lines
925 B
Python
"""Configuration for the file-storage module, sourced from the central Config."""
|
|
|
|
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:
|
|
"""Resolve storage settings from the central ``Config`` singleton.
|
|
|
|
Defaults to the ``local`` backend so development needs no cloud creds.
|
|
"""
|
|
from app.config import config
|
|
|
|
return StorageSettings(
|
|
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,
|
|
)
|