mirror of
https://forgejo.altau.su/lego/lego-monitoring.git
synced 2026-03-10 04:41:10 +00:00
use NestedDeserializableDataclass for config
This commit is contained in:
parent
96664684f8
commit
3eb358d618
13 changed files with 188 additions and 130 deletions
|
|
@ -1,16 +1,13 @@
|
|||
#!/usr/bin/env python3
|
||||
import asyncio
|
||||
import datetime
|
||||
import json
|
||||
import logging
|
||||
import signal
|
||||
|
||||
import aiofiles
|
||||
|
||||
from alerting import alerts
|
||||
from alerting.common import CONFIG_FILE
|
||||
from misc import checks, cvars
|
||||
from misc.checkers import interval_checker, scheduled_checker
|
||||
from misc.config import get_config
|
||||
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
|
||||
|
|
@ -25,9 +22,7 @@ def stop_gracefully(signum, frame):
|
|||
async def main():
|
||||
signal.signal(signal.SIGTERM, stop_gracefully)
|
||||
|
||||
async with aiofiles.open(CONFIG_FILE) as f:
|
||||
contents = await f.read()
|
||||
cvars.config.set(json.loads(contents))
|
||||
cvars.config.set(get_config())
|
||||
|
||||
client = await alerts.get_client()
|
||||
cvars.matrix_client.set(client)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue