Spaces:
Runtime error
Runtime error
File size: 1,277 Bytes
410242f | 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 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | """
Configuration management for Document Intelligence System
"""
import os
from typing import Optional
from functools import lru_cache
class Settings:
"""Application settings"""
# API
API_HOST: str = os.getenv("API_HOST", "0.0.0.0")
API_PORT: int = int(os.getenv("API_PORT", 8000))
DEBUG: bool = os.getenv("DEBUG", "false").lower() == "true"
# Database
DATABASE_URL: str = os.getenv("DATABASE_URL", "sqlite:///./documents.db")
# OCR
OCR_LANG: str = os.getenv("OCR_LANG", "eng")
OCR_PSM: int = int(os.getenv("OCR_PSM", 3))
# File Upload
UPLOAD_DIR: str = os.getenv("UPLOAD_DIR", "./uploads")
MAX_FILE_SIZE: int = int(os.getenv("MAX_FILE_SIZE", 52428800)) # 50MB
# Logging
LOG_LEVEL: str = os.getenv("LOG_LEVEL", "INFO")
# CORS
ENABLE_CORS: bool = os.getenv("ENABLE_CORS", "true").lower() == "true"
# Redis (optional)
REDIS_URL: Optional[str] = os.getenv("REDIS_URL")
# Processing
MAX_BATCH_SIZE: int = 100
PROCESSING_TIMEOUT: int = 300 # seconds
class Config:
env_file = ".env"
@lru_cache()
def get_settings() -> Settings:
"""Get application settings"""
return Settings()
# Export settings
settings = get_settings()
|