""" Application settings and configuration """ from pydantic_settings import BaseSettings from typing import Optional, List import json class Settings(BaseSettings): """Application settings""" # App app_name: str = "Autonomous Incident Management System" app_version: str = "0.1.0" debug: bool = False log_level: str = "INFO" # Database database_url: str = "postgresql://user:password@localhost/aims" database_pool_size: int = 20 database_max_overflow: int = 40 # Redis redis_url: str = "redis://localhost:6379" redis_cache_ttl: int = 3600 # LLM Configuration ollama_base_url: str = "http://localhost:11434" ollama_model: str = "mistral" # mistral, neural-chat, dolphin-mixtral, etc. ollama_temperature: float = 0.7 ollama_num_predict: int = 2048 # max tokens openai_api_key: Optional[str] = None openai_model: str = "gpt-4" openai_temperature: float = 0.7 openai_max_tokens: int = 2000 anthropic_api_key: Optional[str] = None anthropic_model: str = "claude-3-sonnet-20240229" llm_provider: str = "ollama" # ollama, openai, or anthropic llm_timeout: int = 60 # Alert Configuration alert_correlation_window_minutes: int = 5 max_alerts_per_incident: int = 1000 alert_deduplication_ttl_hours: int = 24 # Incident Configuration auto_remediation_enabled: bool = False incident_retention_days: int = 365 critical_incident_escalation_minutes: int = 15 # Notification Configuration slack_bot_token: Optional[str] = None slack_channel_incidents: str = "#incidents" email_from: str = "noreply@company.com" email_smtp_server: str = "smtp.gmail.com" email_smtp_port: int = 587 email_smtp_user: Optional[str] = None email_smtp_password: Optional[str] = None # API Configuration api_prefix: str = "/api/v1" api_title: str = "Autonomous Incident Management System API" api_description: str = "API for autonomous incident detection and management" cors_origins: str = '["http://localhost:3000","http://localhost:5173","http://localhost:8001"]' # Security secret_key: str = "change-me-in-production" algorithm: str = "HS256" access_token_expire_minutes: int = 30 jwt_enabled: bool = True # Monitoring enable_metrics: bool = True metrics_port: int = 8001 # Scheduler scheduler_enabled: bool = True scheduler_timezone: str = "UTC" class Config: env_file = ".env" case_sensitive = False @property def get_cors_origins(self) -> List[str]: """Parse CORS origins from string to list""" try: if isinstance(self.cors_origins, str): return json.loads(self.cors_origins) return self.cors_origins except Exception: return ["http://localhost:3000", "http://localhost:5173", "http://localhost:8001"] settings = Settings()