Files
motovaultpro/ocr/app/config.py
Eric Gullickson 781241966c
All checks were successful
Deploy to Staging / Build Images (pull_request) Successful in 38s
Deploy to Staging / Deploy to Staging (pull_request) Successful in 51s
Deploy to Staging / Verify Staging (pull_request) Successful in 9s
Deploy to Staging / Notify Staging Ready (pull_request) Successful in 8s
Deploy to Staging / Notify Staging Failure (pull_request) Has been skipped
chore: change google region
2026-02-19 20:59:40 -06:00

46 lines
1.7 KiB
Python

"""OCR Service Configuration."""
import os
class Settings:
"""Application settings loaded from environment variables."""
def __init__(self) -> None:
self.log_level: str = os.getenv("LOG_LEVEL", "info")
self.host: str = os.getenv("HOST", "0.0.0.0")
self.port: int = int(os.getenv("PORT", "8000"))
# OCR engine configuration
self.ocr_primary_engine: str = os.getenv("OCR_PRIMARY_ENGINE", "paddleocr")
self.ocr_confidence_threshold: float = float(
os.getenv("OCR_CONFIDENCE_THRESHOLD", "0.6")
)
# Cloud fallback configuration (disabled by default)
self.ocr_fallback_engine: str = os.getenv("OCR_FALLBACK_ENGINE", "none")
self.ocr_fallback_threshold: float = float(
os.getenv("OCR_FALLBACK_THRESHOLD", "0.6")
)
self.google_vision_key_path: str = os.getenv(
"GOOGLE_VISION_KEY_PATH", "/run/secrets/google-wif-config.json"
)
# Google Vision monthly usage cap (requests per calendar month)
self.vision_monthly_limit: int = int(
os.getenv("VISION_MONTHLY_LIMIT", "1000")
)
# Vertex AI / Gemini configuration
self.vertex_ai_project: str = os.getenv("VERTEX_AI_PROJECT", "")
self.vertex_ai_location: str = os.getenv(
"VERTEX_AI_LOCATION", "global"
)
self.gemini_model: str = os.getenv("GEMINI_MODEL", "gemini-2.5-flash")
# Redis configuration for job queue
self.redis_host: str = os.getenv("REDIS_HOST", "mvp-redis")
self.redis_port: int = int(os.getenv("REDIS_PORT", "6379"))
self.redis_db: int = int(os.getenv("REDIS_DB", "1"))
settings = Settings()