Browse Source

Fix default values for timeout and grace parameters in API reference.

pull/340/head
Pēteris Caune 5 years ago
parent
commit
ccba5e8731
No known key found for this signature in database GPG Key ID: E28D7679E9A9EDE2
3 changed files with 14 additions and 10 deletions
  1. +12
    -8
      hc/front/views.py
  2. +1
    -1
      templates/docs/api.html
  3. +1
    -1
      templates/docs/api.md

+ 12
- 8
hc/front/views.py View File

@ -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",


+ 1
- 1
templates/docs/api.html View File

@ -86,7 +86,7 @@ one or more tags.</p>
specified value.</p>
<p>This parameter can be repeated multiple times.</p>
<p>Example:</p>
<p><code>SITE_ROOT/api/v1/checks/?tag=foo&amp;amp;tag=bar</code></p>
<p><code>SITE_ROOT/api/v1/checks/?tag=foo&amp;tag=bar</code></p>
</dd>
</dl>
<h3>Example Request</h3>


+ 1
- 1
templates/docs/api.md View File

@ -66,7 +66,7 @@ tag=&lt;value&gt;
Example:
`SITE_ROOT/api/v1/checks/?tag=foo&amp;tag=bar`
`SITE_ROOT/api/v1/checks/?tag=foo&tag=bar`
### Example Request


Loading…
Cancel
Save