healthy-checker/app/loader.py

23 lines
456 B
Python

import os
import yaml
SERVICES_DIR = "services"
def load_services():
services = []
for filename in os.listdir(SERVICES_DIR):
if not filename.endswith(".yaml"):
continue
path = os.path.join(SERVICES_DIR, filename)
with open(path, "r", encoding="utf-8") as f:
cfg = yaml.safe_load(f)
if not cfg.get("enabled", True):
continue
services.append(cfg)
return services