From e8196730154db7f1e789a4f5044a6342d6beca34 Mon Sep 17 00:00:00 2001 From: Lars Gebhardt-Kusche Date: Mon, 2 Mar 2026 22:07:39 +0100 Subject: [PATCH] db up --- config/staging/settings.php | 2 +- src/App/Database.php | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/config/staging/settings.php b/config/staging/settings.php index 5664d52..cb78543 100755 --- a/config/staging/settings.php +++ b/config/staging/settings.php @@ -5,4 +5,4 @@ define('APP_URL_PRIMARY', 'https://' . 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_DEBUG', true); diff --git a/src/App/Database.php b/src/App/Database.php index 27f9071..678f849 100755 --- a/src/App/Database.php +++ b/src/App/Database.php @@ -45,9 +45,18 @@ final class Database return $pdo; } catch (\PDOException $e) { - // In Prod würdest du loggen; hier minimal 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; } }