You've already forked directdnsonly
- Migrated from setuptools to Poetry; added pyproject.toml, poetry.lock, poetry.toml and .python-version (Python 3.11.12) - Built out full directdnsonly Python package with BIND and CoreDNS MySQL backends, CherryPy REST API, persist-queue worker, and vyper-based config - Auth credentials now read from config/env (app.auth_username/password) rather than hardcoded; override via DADNS_APP_AUTH_PASSWORD env var - Added Dockerfile.deepseek: Python 3.11 slim + BIND9 + Poetry install - Rewrote docker-compose.yml for local dev stack (MySQL + dadns services) - Added SQL schema, docker/ BIND configs, justfile, tests, and README - Expanded .gitignore for Poetry/Python project artifacts
25 lines
649 B
Python
25 lines
649 B
Python
import cherrypy
|
|
from loguru import logger
|
|
|
|
|
|
class HealthAPI:
|
|
def __init__(self, backend_registry):
|
|
self.registry = backend_registry
|
|
|
|
@cherrypy.expose
|
|
def health(self):
|
|
status = {"status": "OK", "backends": []}
|
|
|
|
for name, backend in self.registry.get_available_backends().items():
|
|
status["backends"].append(
|
|
{
|
|
"name": name,
|
|
"status": (
|
|
"active" if backend().zone_exists("test") else "unavailable"
|
|
),
|
|
}
|
|
)
|
|
|
|
logger.debug("Health check performed")
|
|
return status
|