From 279fb2c0c60f90e74520b60d410cb5513d430b86 Mon Sep 17 00:00:00 2001 From: Rocky Chen Date: Wed, 9 Oct 2024 08:28:35 +0800 Subject: [PATCH] Fix a few issues on healthcheck --- authome/urls/urls.py | 2 +- authome/views/healthcheckviews.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/authome/urls/urls.py b/authome/urls/urls.py index 0e36b60..d3f9440 100644 --- a/authome/urls/urls.py +++ b/authome/urls/urls.py @@ -19,7 +19,7 @@ admin_urls[0].insert(0,path('auth2status/', views.auth2_status,name="auth2_status")) admin_urls[0].insert(1,path('liveness///.html', views.auth2_liveness,name="auth2_liveness")) else: - admin_urls[0].insert(0,path('healthcheck', views.auth2_healthcheck,name="auth2_healthcheck")) + admin_urls[0].insert(0,path('healthcheck', views.auth2_status,name="auth2_status")) admin_urls[0].insert(1,path('liveness//.html', views.auth2_liveness,name="auth2_liveness")) admin_urls[0].insert(0,path('authome/tools/apple/secretkey/renew', views.renew_apple_secretkey,name="renew_apple_secretkey")) diff --git a/authome/views/healthcheckviews.py b/authome/views/healthcheckviews.py index a997de5..1f4a630 100644 --- a/authome/views/healthcheckviews.py +++ b/authome/views/healthcheckviews.py @@ -19,11 +19,11 @@ def _auth2_cluster_status(request,clusterid): def _auth2_status(request): - f = os.path.join(settings.AUTH2_MONITORING_DIR,"auth2","serverinfo.html") + f = os.path.join(settings.AUTH2_MONITORING_DIR,"auth2","standalone","serverinfo.html") if os.path.exists(f): return FileResponse(open(f,'rb')) else: - return TemplateResponse(request,"authome/healthcheck_not_enabled.html",context={"message":"The healthcheck is not enabled for auth2 server".format(clusterid)}) + return TemplateResponse(request,"authome/healthcheck_not_enabled.html",context={"message":"The healthcheck is not enabled for auth2 server"}) def _auth2_cluster_liveness(request,clusterid,serviceid,monitordate): if clusterid == settings.AUTH2_CLUSTERID: @@ -32,7 +32,7 @@ def _auth2_cluster_liveness(request,clusterid,serviceid,monitordate): return HttpResponse(cache.get_auth2_liveness(clusterid,serviceid,monitordate),content_type="text/html") def _auth2_liveness(request,serviceid,monitordate): - return FileResponse(open(os.path.join(settings.AUTH2_MONITORING_DIR,"auth2",serviceid,"{}.html".format(monitordate)),'rb')) + return FileResponse(open(os.path.join(settings.AUTH2_MONITORING_DIR,"auth2","standalone",serviceid,"{}.html".format(monitordate)),'rb')) auth2_status = _auth2_cluster_status if settings.AUTH2_CLUSTER_ENABLED else _auth2_status auth2_liveness = _auth2_cluster_liveness if settings.AUTH2_CLUSTER_ENABLED else _auth2_liveness