Add unit tests for Bird department gate phone call logic, Edge Broker configuration, and gateway heartbeat status. Refactor warnings handling, Slack notifications, Bird client usage, and Edge gateway probes for improved maintainability and error clarity.
This commit is contained in:
@@ -6,6 +6,9 @@ use Exception;
|
||||
|
||||
class edge_broker_client
|
||||
{
|
||||
private const DEFAULT_BROKER_URL = 'http://edge-broker:4300';
|
||||
private const DEFAULT_SHARED_SECRET = 'truckwash-edge-dev';
|
||||
|
||||
public function __construct(
|
||||
private readonly ?string $baseUrl = null,
|
||||
private readonly ?string $sharedSecret = null,
|
||||
@@ -64,12 +67,15 @@ class edge_broker_client
|
||||
|
||||
private function resolveBaseUrl(): string
|
||||
{
|
||||
return trim((string)($this->baseUrl ?? getenv('EDGE_BROKER_URL') ?: 'http://edge-broker:4300'));
|
||||
return trim((string)($this->baseUrl ?? getenv('EDGE_BROKER_URL') ?: self::DEFAULT_BROKER_URL));
|
||||
}
|
||||
|
||||
private function resolveSharedSecret(): string
|
||||
{
|
||||
return trim((string)($this->sharedSecret ?? getenv('EDGE_BROKER_SHARED_SECRET') ?: getenv('EDGE_INTERNAL_SECRET') ?: ''));
|
||||
return trim((string)($this->sharedSecret
|
||||
?? getenv('EDGE_BROKER_SHARED_SECRET')
|
||||
?: getenv('EDGE_INTERNAL_SECRET')
|
||||
?: self::DEFAULT_SHARED_SECRET));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user