Files
bakery-ia/services/alert_processor/app/config.py
2025-08-23 10:19:58 +02:00

49 lines
1.8 KiB
Python

# services/alert_processor/app/config.py
"""
Alert Processor Service Configuration
"""
import os
from typing import List
from shared.config.base import BaseServiceSettings
class AlertProcessorConfig(BaseServiceSettings):
"""Configuration for Alert Processor Service"""
SERVICE_NAME: str = "alert-processor"
APP_NAME: str = "Alert Processor Service"
DESCRIPTION: str = "Central alert and recommendation processor"
# Use the notification database for alert storage
# This makes sense since alerts and notifications are closely related
DATABASE_URL: str = os.getenv(
"NOTIFICATION_DATABASE_URL",
"postgresql+asyncpg://notification_user:notification_pass123@notification-db:5432/notification_db"
)
# Use dedicated Redis DB for alert processing
REDIS_DB: int = int(os.getenv("ALERT_PROCESSOR_REDIS_DB", "6"))
# Alert processing configuration
BATCH_SIZE: int = int(os.getenv("ALERT_BATCH_SIZE", "10"))
PROCESSING_TIMEOUT: int = int(os.getenv("ALERT_PROCESSING_TIMEOUT", "30"))
# Deduplication settings
ALERT_DEDUPLICATION_WINDOW_MINUTES: int = int(os.getenv("ALERT_DEDUPLICATION_WINDOW_MINUTES", "15"))
RECOMMENDATION_DEDUPLICATION_WINDOW_MINUTES: int = int(os.getenv("RECOMMENDATION_DEDUPLICATION_WINDOW_MINUTES", "60"))
# Alert severity channel mappings (hardcoded for now to avoid config parsing issues)
@property
def urgent_channels(self) -> List[str]:
return ["whatsapp", "email", "push", "dashboard"]
@property
def high_channels(self) -> List[str]:
return ["whatsapp", "email", "dashboard"]
@property
def medium_channels(self) -> List[str]:
return ["email", "dashboard"]
@property
def low_channels(self) -> List[str]:
return ["dashboard"]