Compare commits
1 Commits
ai/issue-4
...
ai/issue-2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d0d6f1bfc5 |
21
LICENSE
Normal file
21
LICENSE
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2024 Luca Haid
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -1,50 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Health Check Endpoint
|
||||
* Returns application health status and database connectivity
|
||||
*/
|
||||
|
||||
header('Content-Type: application/json');
|
||||
|
||||
$health = [
|
||||
'status' => 'ok',
|
||||
'timestamp' => time()
|
||||
];
|
||||
|
||||
// Check database connection
|
||||
$dbConnected = false;
|
||||
$dbError = null;
|
||||
|
||||
try {
|
||||
$conn = @mysqli_connect(
|
||||
'aide-mariadb',
|
||||
'aide',
|
||||
'aide',
|
||||
'thetool_s13'
|
||||
);
|
||||
|
||||
if ($conn) {
|
||||
$dbConnected = true;
|
||||
mysqli_close($conn);
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
$dbError = $e->getMessage();
|
||||
}
|
||||
|
||||
if ($dbConnected) {
|
||||
$health['db'] = true;
|
||||
} else {
|
||||
$health['db'] = false;
|
||||
if ($dbError) {
|
||||
$health['db_error'] = $dbError;
|
||||
}
|
||||
}
|
||||
|
||||
// Set HTTP status code
|
||||
if ($health['db']) {
|
||||
http_response_code(200);
|
||||
} else {
|
||||
http_response_code(503); // Service Unavailable
|
||||
}
|
||||
|
||||
echo json_encode($health);
|
||||
Reference in New Issue
Block a user