db up
This commit is contained in:
@@ -5,4 +5,4 @@
|
|||||||
define('APP_URL_PRIMARY', 'https://' . APP_DOMAIN_PRIMARY);
|
define('APP_URL_PRIMARY', 'https://' . APP_DOMAIN_PRIMARY);
|
||||||
define('APP_API_BASE', 'https://api.' . APP_DOMAIN_PRIMARY);
|
define('APP_API_BASE', 'https://api.' . APP_DOMAIN_PRIMARY);
|
||||||
define('APP_DB_ENABLED', true); // set true to enable DB connection
|
define('APP_DB_ENABLED', true); // set true to enable DB connection
|
||||||
|
define('APP_DB_DEBUG', true);
|
||||||
|
|||||||
@@ -45,9 +45,18 @@ final class Database
|
|||||||
|
|
||||||
return $pdo;
|
return $pdo;
|
||||||
} catch (\PDOException $e) {
|
} catch (\PDOException $e) {
|
||||||
// In Prod würdest du loggen; hier minimal
|
|
||||||
http_response_code(500);
|
http_response_code(500);
|
||||||
echo 'Database connection error.';
|
|
||||||
|
$env = defined('APP_ENV') ? APP_ENV : 'prod';
|
||||||
|
$dbDebug = defined('APP_DB_DEBUG') && APP_DB_DEBUG;
|
||||||
|
$details = 'Database connection error.';
|
||||||
|
|
||||||
|
if ($env !== 'prod' || $dbDebug) {
|
||||||
|
$details .= ' ' . $e->getMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
error_log('[DB] ' . $e->getMessage());
|
||||||
|
echo $details;
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user