feat: support root database connection fallback and align env vars

This commit is contained in:
Andrie
2026-06-12 10:59:00 +07:00
parent d3d263d6d5
commit 05f18aeab1
4 changed files with 20 additions and 2 deletions
+6
View File
@@ -17,6 +17,12 @@ function check_database(string $label, string $database, ?string $user = null, ?
$connection = @new mysqli($host, $username, $dbPassword, $database, $port);
if ($connection->connect_error && $username !== env_value('DB_USER', 'root')) {
$username = env_value('DB_USER', 'root');
$dbPassword = env_value('DB_PASS', '');
$connection = @new mysqli($host, $username, $dbPassword, $database, $port);
}
if ($connection->connect_error) {
error_log("Health check database failed ({$label}): " . $connection->connect_error);
return [