Skip to content

Commit 18cf8a7

Browse files
committed
fix: health check details
1 parent bbabb88 commit 18cf8a7

File tree

1 file changed

+47
-8
lines changed

1 file changed

+47
-8
lines changed

api/urls.py

+47-8
Original file line numberDiff line numberDiff line change
@@ -41,22 +41,61 @@
4141

4242
# TODO: delete this after finish testing
4343
# pylint: disable=wrong-import-position, wrong-import-order,ungrouped-imports
44-
import logging
45-
4644
from codeforlife.views import HealthCheckView as _HealthCheckView
45+
from codeforlife.views.health_check import HealthCheck
4746
from django.conf import settings
4847

4948

5049
# pylint: disable-next=missing-class-docstring
5150
class HealthCheckView(_HealthCheckView):
5251
def get_health_check(self, request):
53-
# pylint: disable-next=logging-fstring-interpolation
54-
logging.warning(
55-
f"STATIC_ROOT: {settings.STATIC_ROOT}."
56-
f" STATIC_URL: {settings.STATIC_URL}."
57-
f" AWS_STORAGE_BUCKET_NAME: {settings.AWS_STORAGE_BUCKET_NAME}."
52+
health_check = super().get_health_check(request)
53+
return HealthCheck(
54+
health_status=health_check.health_status,
55+
additional_info=health_check.additional_info,
56+
details=[
57+
HealthCheck.Detail(
58+
name="STATIC_ROOT",
59+
description=str(settings.STATIC_ROOT),
60+
health="healthy",
61+
),
62+
HealthCheck.Detail(
63+
name="STATIC_URL",
64+
description=str(settings.STATIC_URL),
65+
health="healthy",
66+
),
67+
HealthCheck.Detail(
68+
name="AWS_STORAGE_BUCKET_NAME",
69+
description=str(settings.AWS_STORAGE_BUCKET_NAME),
70+
health="healthy",
71+
),
72+
HealthCheck.Detail(
73+
name="AWS_S3_CUSTOM_DOMAIN",
74+
description=str(settings.AWS_S3_CUSTOM_DOMAIN),
75+
health="healthy",
76+
),
77+
HealthCheck.Detail(
78+
name="AWS_LOCATION",
79+
description=str(settings.AWS_LOCATION),
80+
health="healthy",
81+
),
82+
HealthCheck.Detail(
83+
name="AWS_DEFAULT_ACL",
84+
description=str(settings.AWS_DEFAULT_ACL),
85+
health="healthy",
86+
),
87+
HealthCheck.Detail(
88+
name="AWS_S3_ADDRESSING_STYLE",
89+
description=str(settings.AWS_S3_ADDRESSING_STYLE),
90+
health="healthy",
91+
),
92+
HealthCheck.Detail(
93+
name="AWS_S3_REGION_NAME",
94+
description=str(settings.AWS_S3_REGION_NAME),
95+
health="healthy",
96+
),
97+
],
5898
)
59-
return super().get_health_check(request)
6099

61100

62101
urlpatterns = get_urlpatterns(

0 commit comments

Comments
 (0)