mirror of
https://forgejo.altau.su/lego/lego-monitoring.git
synced 2026-03-10 04:41:10 +00:00
29 lines
667 B
Python
29 lines
667 B
Python
from dataclasses import dataclass
|
|
from typing import Optional
|
|
|
|
from alt_utils import NestedDeserializableDataclass
|
|
|
|
|
|
@dataclass
|
|
class TelegramConfig:
|
|
creds: str
|
|
room_id: int
|
|
|
|
|
|
@dataclass
|
|
class HealthchecksConfig:
|
|
pinging_keys: str | dict[str, str]
|
|
pinging_api_endpoint: str
|
|
|
|
def __post_init__(self):
|
|
lines = self.pinging_keys.split()
|
|
self.pinging_keys = {}
|
|
for l in lines:
|
|
slug, key = l.split(":")
|
|
self.pinging_keys[slug] = key
|
|
|
|
|
|
@dataclass
|
|
class AlertChannelsConfig(NestedDeserializableDataclass):
|
|
telegram: Optional[TelegramConfig] = None
|
|
healthchecks: Optional[HealthchecksConfig] = None
|