Skip to content

Commit d35e652

Browse files
Merge pull request #80 from walters-labs/add_health_check_for_api
validate API key for health check
2 parents be2ffdf + 17b6b92 commit d35e652

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

api/health.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,12 @@
1414
try {
1515
$db = get_db();
1616

17-
// Optional: validate API key, or skip for public health check
18-
// $api_key = validate_api_key($db);
17+
/* 1. Validate API key */
18+
$api_key = validate_api_key($db);
19+
20+
/* 2. Rate limit */
21+
$limit = fetch_rate_limit($db, $api_key);
22+
check_rate_limit($db, $api_key, $limit);
1923

2024
// Lightweight DB check using fetchOne
2125
$result = $db->fetchOne("SELECT 1", [], "");

0 commit comments

Comments
 (0)