File size: 891 Bytes
deff797 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | import os
from pathlib import Path
from typing import Optional
class Config:
"""Application configuration."""
# Hugging Face
HUGGINGFACE_TOKEN: Optional[str] = os.getenv("HUGGINGFACE_TOKEN")
# Logging
LOG_LEVEL: str = os.getenv("LOG_LEVEL", "INFO")
ENABLE_VERBATIM_LOGS: bool = os.getenv("ENABLE_VERBATIM_LOGS", "true").lower() == "true"
# Paths
BASE_DIR = Path(__file__).parent.parent.parent
VERBATIM_LOG_PATH = BASE_DIR / os.getenv("VERBATIM_LOG_PATH", "logs/verbatim")
REDACTED_LOG_PATH = BASE_DIR / os.getenv("REDACTED_LOG_PATH", "logs/redacted")
@classmethod
def ensure_log_dirs(cls):
"""Create log directories if they don't exist."""
cls.VERBATIM_LOG_PATH.mkdir(parents=True, exist_ok=True)
cls.REDACTED_LOG_PATH.mkdir(parents=True, exist_ok=True)
config = Config()
config.ensure_log_dirs()
|