Repository navigation
Expand file tree
/
Copy pathconfig.py
More file actions
39 lines (31 loc) · 1.47 KB
/
Copy pathconfig.py
File metadata and controls
39 lines (31 loc) · 1.47 KB
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
import os
from typing import Optional
class Config:
"""Centralized configuration for DMARC agent"""
# OpenAI Configuration
OPENAI_MODEL: str = os.getenv("OPENAI_MODEL", "gpt-4.1")
OPENAI_MAX_RETRIES: int = int(os.getenv("OPENAI_MAX_RETRIES", "3"))
OPENAI_TIMEOUT: int = int(os.getenv("OPENAI_TIMEOUT", "60"))
# Slack Configuration
SLACK_BOT_TOKEN: Optional[str] = os.getenv("SLACK_BOT_TOKEN")
DMARC_CHANNEL_ID: Optional[str] = os.getenv("DMARC_CHANNEL_ID")
SLACK_MAX_RETRIES: int = int(os.getenv("SLACK_MAX_RETRIES", "3"))
# Processing Limits
MAX_ATTACHMENT_SIZE_MB: int = int(os.getenv("MAX_ATTACHMENT_SIZE_MB", "25"))
MAX_ATTACHMENTS_PER_EMAIL: int = int(os.getenv("MAX_ATTACHMENTS_PER_EMAIL", "10"))
# IP Investigation Configuration
MAX_IPS_TO_INVESTIGATE: int = int(os.getenv("MAX_IPS_TO_INVESTIGATE", "20"))
IP_INVESTIGATION_TIMEOUT: float = float(os.getenv("IP_INVESTIGATION_TIMEOUT", "60.0"))
MIN_RISK_SCORE: int = int(os.getenv("MIN_RISK_SCORE", "40"))
# Storage
KV_STORE_NAME: str = "dmarc-reports"
@classmethod
def validate(cls) -> list[str]:
"""Validates required configuration and returns list of errors"""
errors = []
if not cls.SLACK_BOT_TOKEN:
errors.append("SLACK_BOT_TOKEN environment variable is required")
if not cls.DMARC_CHANNEL_ID:
errors.append("DMARC_CHANNEL_ID environment variable is required")
return errors
config = Config()