Files
mtusi2026lab6/worker/pipeline/config.py
T

25 lines
900 B
Python

import os
from dataclasses import dataclass
from pathlib import Path
def secret(name):
return Path("/run/secrets/" + name).read_text().strip()
@dataclass(frozen=True)
class Settings:
db_host: str = os.getenv("DB_HOST", "db")
broker_host: str = os.getenv("BROKER_HOST", "broker")
bucket: str = os.getenv("S3_BUCKET", "messenger-attachments")
endpoint: str = os.getenv("S3_ENDPOINT", "http://minio:9000")
max_attempts: int = int(os.getenv("JOB_MAX_ATTEMPTS", "5"))
timeout: int = int(os.getenv("JOB_TIMEOUT_SECONDS", "60"))
retention: int = int(os.getenv("STAGING_RETENTION_SECONDS", "86400"))
lease: int = int(os.getenv("JOB_LEASE_SECONDS", "75"))
faults: bool = os.getenv("FAULT_INJECTION_ENABLED", "false").lower() == "true"
max_bytes: int = 10485760
max_pixels: int = 40000000
stream: str = "attachment-jobs"
group: str = "image-workers"