Skip to content

Commit

Permalink
Verify TLS based on node settings
Browse files Browse the repository at this point in the history
  • Loading branch information
ericwang401 committed Jan 28, 2024
1 parent 92405f8 commit 18929d9
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions app/Repositories/Proxmox/ProxmoxRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

namespace Convoy\Repositories\Proxmox;

use Convoy\Exceptions\Repository\Proxmox\ProxmoxConnectionException;
use Convoy\Models\Node;
use Convoy\Models\Server;
use Webmozart\Assert\Assert;
use Illuminate\Support\Facades\Http;
use Illuminate\Http\Client\Response;
use Illuminate\Contracts\Foundation\Application;
use Illuminate\Http\Client\PendingRequest;
use Illuminate\Http\Client\RequestException;
use Illuminate\Contracts\Foundation\Application;
use Convoy\Exceptions\Repository\Proxmox\ProxmoxConnectionException;
use Illuminate\Http\Client\Response;
use Illuminate\Support\Facades\Http;
use Webmozart\Assert\Assert;

abstract class ProxmoxRepository
{
Expand Down Expand Up @@ -56,20 +56,22 @@ public function setNode(Node $node): static
*
* @return mixed
*/
public function getData(array|string $response)
public function getData(array|string $response): mixed
{
return $response['data'] ?? $response;
}

/**
* Return an instance of the Guzzle HTTP Client to be used for requests.
*/
public function getHttpClient(array $headers = [], array $options = [], bool $shouldAuthorize = true): PendingRequest
public function getHttpClient(
array $headers = [], array $options = [], bool $shouldAuthorize = true,
): PendingRequest
{
Assert::isInstanceOf($this->node, Node::class);

return Http::withOptions(array_merge([
'verify' => $this->app->environment('production'),
'verify' => $this->node->verify_tls,
'base_uri' => "https://{$this->node->fqdn}:{$this->node->port}/",
'timeout' => config('convoy.guzzle.timeout'),
'connect_timeout' => config('convoy.guzzle.connect_timeout'),
Expand Down

0 comments on commit 18929d9

Please sign in to comment.