refactor and rewrite for asyncio

This commit is contained in:
2026-02-06 12:34:59 -05:00
parent 700ea8d6a4
commit 4df700e4ef
54 changed files with 772 additions and 4334 deletions
+5 -3
View File
@@ -1,4 +1,5 @@
"""Configuration loader and defaults for hbd."""
import logging
import os
try:
@@ -14,6 +15,8 @@ DEFAULTS = {
"logfile": "/var/log/heartbeat.log",
"logfmt": "text",
"pushsrv": "pushover",
"pushover_token": "",
"pushover_user": "",
"interval": 20,
"grace": 2,
"dyndomains": ["wrede.org"],
@@ -40,14 +43,13 @@ def load_config(path=None):
if os.path.exists(path):
if yaml:
with open(path) as fh:
data = yaml.safe_load(fh) or {}
data = yaml.safe_load(fh)
# only keep known keys
for k, v in data.items():
if k in cfg:
cfg[k] = v
else:
# ignore unknown keys for now
pass
logging.warning("unknown config key %s in %s", k, path)
else:
# yaml not installed: do not attempt to parse; user must ensure defaults
pass