diff --git a/hc/front/views.py b/hc/front/views.py index ba9cf6e0..cd074db8 100644 --- a/hc/front/views.py +++ b/hc/front/views.py @@ -276,15 +276,19 @@ def serve_doc(request, doc="introduction"): if not os.path.exists(path): raise Http404("not found") + replaces = { + "{{ default_timeout }}": str(int(DEFAULT_TIMEOUT.total_seconds())), + "{{ default_grace }}": str(int(DEFAULT_GRACE.total_seconds())), + "SITE_NAME": settings.SITE_NAME, + "SITE_ROOT": settings.SITE_ROOT, + "PING_ENDPOINT": settings.PING_ENDPOINT, + "IMG_URL": os.path.join(settings.STATIC_URL, "img/docs"), + "PING_EMAIL": "your-uuid-here@%s" % settings.PING_EMAIL_DOMAIN, + } + content = open(path, "r", encoding="utf-8").read() - content = content.replace("SITE_NAME", settings.SITE_NAME) - content = content.replace("SITE_ROOT", settings.SITE_ROOT) - content = content.replace("PING_URL", settings.PING_ENDPOINT + "your-uuid-here") - content = content.replace("PING_ENDPOINT", settings.PING_ENDPOINT) - content = content.replace("IMG_URL", os.path.join(settings.STATIC_URL, "img/docs")) - content = content.replace( - "PING_EMAIL", "your-uuid-here@%s" % settings.PING_EMAIL_DOMAIN - ) + for placeholder, value in replaces.items(): + content = content.replace(placeholder, value) ctx = { "page": "docs", diff --git a/templates/docs/api.html b/templates/docs/api.html index f86b80be..3bb14260 100644 --- a/templates/docs/api.html +++ b/templates/docs/api.html @@ -86,7 +86,7 @@ one or more tags.
specified value.This parameter can be repeated multiple times.
Example:
-SITE_ROOT/api/v1/checks/?tag=foo&tag=bar
SITE_ROOT/api/v1/checks/?tag=foo&tag=bar