Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add public_health_check endpoint #248

Merged
merged 1 commit into from
Aug 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions base/views.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
from django.conf import settings
from django.core.cache import cache
from django.http import JsonResponse
from django.shortcuts import render, redirect
from django.utils.translation import gettext as _
from wagtail.admin import messages

from base.forms import CMSUpgradeForm
from base.utils import get_latest_cms_release, send_upgrade_command
from nmhs_cms import __version__
from nmhs_cms.utils.version import check_version_greater_than_current, get_main_version


Expand Down Expand Up @@ -107,3 +109,9 @@ def cms_version_view(request):
context.update({"cms_upgrade_pending": cache.get("cms_upgrade_pending")})

return render(request, template_name, context=context)


def public_health_check(request):
return JsonResponse({
"version": __version__,
})
3 changes: 2 additions & 1 deletion nmhs_cms/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from wagtail.urls import WAGTAIL_FRONTEND_LOGIN_TEMPLATE, serve_pattern
from wagtailcache.cache import cache_page

from base.views import humans
from base.views import humans, public_health_check
from nmhs_cms.api import api_router
from pages.search import views as search_views
from climweb_wdqms import urls as climweb_wdqms_urls
Expand Down Expand Up @@ -45,6 +45,7 @@

path("api/satellite-imagery/", include("pages.satellite_imagery.urls")),
path("api/cityclimate/", include("pages.cityclimate.urls")),
path("api/_health/", public_health_check),
]

if ADMIN_URL_PATH:
Expand Down