Skip to content

Commit

Permalink
wip: ignore health check endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
Sandro-Meireles committed Feb 26, 2024
1 parent 902bd4f commit 654b4f5
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
9 changes: 8 additions & 1 deletion apip/middlewares/subdomain_mock.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,18 @@
from apip.fackers import get_faker


def is_health_check_endpoint(request: Request):
print(request.path)
return bool(request.path == f"/{settings.HEALTH_CHECK_ENDPOINT}")


def get_request_subdomain(request: Request) -> str:
if is_health_check_endpoint(request):
return None

host: str = request.get_host()

print(host)

host_parts = request.get_host().split(".")

if host.startswith("127.0.0.1"):
Expand Down
7 changes: 7 additions & 0 deletions apip/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,4 +135,11 @@
],
}

# Health check settings

HEALTH_CHECK_ENDPOINT = "health-check"


# Mock settings

FAKER_CLASS = "application.fackers.CLIJSFFaker"
2 changes: 1 addition & 1 deletion apip/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

urlpatterns = [
path("", lambda service: redirect("adminservices/service/", permanent=True)),
path("health-check", HealthCheckView.as_view()),
path(settings.HEALTH_CHECK_ENDPOINT, HealthCheckView.as_view()),
path("admin", admin.site.urls),
path("api/", include(testplans_urls)),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

0 comments on commit 654b4f5

Please sign in to comment.