fixing telegram
Deploy / deploy (push) Successful in 8s

This commit is contained in:
2026-05-06 18:30:55 +02:00
parent e203aac2f5
commit 23e37c2e1a
2 changed files with 9 additions and 2 deletions
+8 -1
View File
@@ -3,6 +3,7 @@
namespace Jakach\Logging\Api;
use Jakach\Logging\Model\{LogSourceType, AlertStatus};
use Jakach\Logging\Notifier\TelegramNotifier;
use Jakach\Logging\Storage\{Database, Repository};
use Jakach\Logging\RuleEngine\Engine;
@@ -11,6 +12,7 @@ class Router
private Repository $repo;
private AuthMiddleware $auth;
private Engine $engine;
private TelegramNotifier $telegram;
public function __construct()
{
@@ -18,6 +20,7 @@ class Router
$this->repo = new Repository($db);
$this->auth = new AuthMiddleware($this->repo);
$this->engine = new Engine($this->repo);
$this->telegram = new TelegramNotifier($this->repo);
}
public function handle(): void
@@ -272,7 +275,11 @@ class Router
return ['error' => 'Missing "line" field'];
}
$this->engine->evaluate($line, null);
$alert = $this->engine->evaluate($line, null);
if ($alert !== null) {
$this->telegram->send($alert);
}
return ['status' => 'ingested', 'line' => substr($line, 0, 100)];
}