Skip to content

Commit be9466d

Browse files
committed
feat: add ping path to authentication bypass and implement API health check endpoint for monitoring
1 parent 4e87669 commit be9466d

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

src/primary/auth.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,9 +267,10 @@ def authenticate_request():
267267
api_setup_path = "/api/setup"
268268
favicon_path = "/favicon.ico"
269269
health_check_path = "/api/health"
270+
ping_path = "/ping"
270271

271-
# Skip authentication for static files, setup pages and health check path
272-
if request.path.startswith((static_path, setup_path, api_setup_path)) or request.path in (favicon_path, health_check_path):
272+
# Skip authentication for static files, setup pages, health check path, and ping
273+
if request.path.startswith((static_path, setup_path, api_setup_path)) or request.path in (favicon_path, health_check_path, ping_path):
273274
return None
274275

275276
# If no user exists, redirect to setup

src/primary/web_server.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1075,6 +1075,17 @@ def health_check():
10751075
logger.debug("Health check endpoint accessed")
10761076
return jsonify({"status": "OK"})
10771077

1078+
@app.route('/api/health', methods=['GET'])
1079+
def api_health_check():
1080+
"""
1081+
API health check endpoint that bypasses authentication.
1082+
Returns a status OK response to indicate the application is running properly.
1083+
This endpoint is useful for monitoring tools and load balancers.
1084+
"""
1085+
logger = get_logger("system")
1086+
logger.debug("API health check endpoint accessed")
1087+
return jsonify({"status": "OK", "message": "Huntarr is running"})
1088+
10781089
@app.route('/api/github_sponsors', methods=['GET'])
10791090
def get_github_sponsors():
10801091
# API access configuration

0 commit comments

Comments
 (0)