Files
meet/src/summary/summary/core/config.py
T
lebaudantoine cbabcb877b 🐛(summary) add audio duration limit to prevent long-running jobs
Set default 1h30 limit for audio processing to prevent Whisper from
running excessively long on large recordings. Improves resource
management and job completion times.
2025-07-10 18:13:32 +02:00

69 lines
1.8 KiB
Python

"""Application configuration and settings."""
from functools import lru_cache
from typing import Annotated, Optional
from fastapi import Depends
from pydantic_settings import BaseSettings, SettingsConfigDict
class Settings(BaseSettings):
"""Configuration settings loaded from environment variables and .env file."""
model_config = SettingsConfigDict(env_file=".env")
app_name: str = "app"
app_api_v1_str: str = "/api/v1"
app_api_token: str
# Audio recordings
recording_max_duration: int = 5400 # 1h30
# Celery settings
celery_broker_url: str = "redis://redis/0"
celery_result_backend: str = "redis://redis/0"
celery_max_retries: int = 1
# Minio settings
aws_storage_bucket_name: str
aws_s3_endpoint_url: str
aws_s3_access_key_id: str
aws_s3_secret_access_key: str
aws_s3_secure_access: bool = True
# AI-related settings
openai_api_key: str
openai_base_url: str = "https://api.openai.com/v1"
openai_asr_model: str = "whisper-1"
openai_llm_model: str = "gpt-4o"
openai_max_retries: int = 0
# Webhook-related settings
webhook_max_retries: int = 2
webhook_status_forcelist: list[int] = [502, 503, 504]
webhook_backoff_factor: float = 0.1
webhook_api_token: str
webhook_url: str
# Sentry
sentry_is_enabled: bool = False
sentry_dsn: Optional[str] = None
# Posthog (analytics)
posthog_enabled: bool = False
posthog_api_key: Optional[str] = None
posthog_api_host: Optional[str] = "https://eu.i.posthog.com"
# TaskTracker
task_tracker_redis_url: str = "redis://redis/0"
task_tracker_prefix: str = "task_metadata:"
@lru_cache
def get_settings():
"""Load and cache application settings."""
return Settings()
SettingsDeps = Annotated[Settings, Depends(get_settings)]