Test ogdClient
testing/ogcore-api/pipeline/head This commit looks good
Details
testing/ogcore-api/pipeline/head This commit looks good
Details
parent
4973be6af6
commit
1db829d9ff
|
@ -22,18 +22,10 @@ use Symfony\Contracts\HttpClient\HttpClientInterface;
|
||||||
#[AsController]
|
#[AsController]
|
||||||
class StatusAction extends AbstractController
|
class StatusAction extends AbstractController
|
||||||
{
|
{
|
||||||
protected readonly HttpClientInterface $httpClient;
|
|
||||||
|
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
protected readonly EntityManagerInterface $entityManager,
|
protected readonly EntityManagerInterface $entityManager,
|
||||||
)
|
protected readonly HttpClientInterface $httpClient
|
||||||
{
|
) {}
|
||||||
$this->httpClient = HttpClient::create([
|
|
||||||
'verify_peer' => false,
|
|
||||||
'verify_host' => false,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws TransportExceptionInterface
|
* @throws TransportExceptionInterface
|
||||||
|
@ -48,8 +40,11 @@ class StatusAction extends AbstractController
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$response = $this->httpClient->request('POST', 'https://' . $client->getIp() . ':8000/ogAdmClient/status');
|
$response = $this->httpClient->request('POST', 'https://' . $client->getIp() . ':8000/ogAdmClient/status', [
|
||||||
|
'verify_peer' => false,
|
||||||
|
'verify_host' => false,
|
||||||
|
'timeout' => 10,
|
||||||
|
]);
|
||||||
$statusCode = $response->getStatusCode();
|
$statusCode = $response->getStatusCode();
|
||||||
$client->setStatus($statusCode === Response::HTTP_OK ? 'active' : 'off');
|
$client->setStatus($statusCode === Response::HTTP_OK ? 'active' : 'off');
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue