Deploy: 2026-05-22 00:31:48

This commit is contained in:
Hamza-Ayed
2026-05-22 00:31:48 +03:00
parent 5d9f54958d
commit 471fbac188

View File

@@ -17,7 +17,28 @@ $logs = \App\Core\Database::select("SELECT * FROM messages_log ORDER BY id DESC
$sessions = \App\Core\Database::select("SELECT * FROM whatsapp_sessions");
// Check Node.js gateway status from the PHP environment
$gatewayUrl = rtrim(getenv('WHATSAPP_GATEWAY_URL') ?: 'http://localhost:3722', '/');
$ch = curl_init($gatewayUrl . '/health');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 3);
$healthResponse = curl_exec($ch);
$healthHttpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$healthError = curl_error($ch);
curl_close($ch);
echo json_encode([
'env' => [
'WHATSAPP_GATEWAY_URL' => getenv('WHATSAPP_GATEWAY_URL'),
'WEBHOOK_SECRET_SET' => !empty(getenv('WEBHOOK_SECRET')),
'APP_URL' => getenv('APP_URL')
],
'gateway_health' => [
'url' => $gatewayUrl . '/health',
'http_code' => $healthHttpCode,
'response' => json_decode($healthResponse, true) ?: $healthResponse,
'error' => $healthError
],
'chatbot_rules' => $rules,
'messages_log' => $logs,
'whatsapp_sessions' => $sessions