mirror of
https://forgejo.altau.su/lego/lego-monitoring.git
synced 2026-03-10 12:45:19 +00:00
prepare config for healthchecks integration
This commit is contained in:
parent
4558cf9e6f
commit
c01ab8303c
8 changed files with 89 additions and 34 deletions
28
src/lego_monitoring/config/alert_channels.py
Normal file
28
src/lego_monitoring/config/alert_channels.py
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
from dataclasses import dataclass, field
|
||||
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]
|
||||
|
||||
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
|
||||
Loading…
Add table
Add a link
Reference in a new issue