diff --git a/src/Controller/API/ContaoManager/ContaoManager.php b/src/Controller/API/ContaoManager/ContaoManager.php index 215fef8..87a71af 100644 --- a/src/Controller/API/ContaoManager/ContaoManager.php +++ b/src/Controller/API/ContaoManager/ContaoManager.php @@ -4,7 +4,6 @@ use Contao\Environment; use Contao\System; -use Doctrine\DBAL\Connection; use Doctrine\DBAL\Exception; use Oveleon\ProductInstaller\ContaoManagerFile; use Symfony\Component\HttpClient\HttpClient; @@ -85,9 +84,10 @@ public function call(string $route, string $method = 'GET', null|string $body = $parameter['body'] = $body; } - // ToDo: Remove in production - #$parameter['verify_peer'] = false; - #$parameter['verify_host'] = false; + $blnDebug = System::getContainer()->getParameter('kernel.debug'); + + $parameter['verify_peer'] = !$blnDebug; + $parameter['verify_host'] = !$blnDebug; return (HttpClient::create())->request( $method, diff --git a/src/Util/ConnectorUtil.php b/src/Util/ConnectorUtil.php index 0b01d5f..51f0308 100644 --- a/src/Util/ConnectorUtil.php +++ b/src/Util/ConnectorUtil.php @@ -3,6 +3,7 @@ namespace Oveleon\ProductInstaller\Util; use Contao\Controller; +use Contao\System; use Oveleon\ProductInstaller\LicenseConnector\AbstractLicenseConnector; use Oveleon\ProductInstaller\LicenseConnector\Step\AbstractStep; use Symfony\Contracts\HttpClient\ResponseInterface; @@ -20,12 +21,14 @@ class ConnectorUtil */ public function post(AbstractLicenseConnector $connector, string $route, array $body = []): ResponseInterface { + $blnDebug = System::getContainer()->getParameter('kernel.debug'); + return (HttpClient::create())->request( 'POST', $connector->getConfig()['entry'] . $route, [ - //'verify_peer' => false, // ToDO: Remove in production - //'verify_host' => false, // ToDO: Remove in production + 'verify_peer' => !$blnDebug, + 'verify_host' => !$blnDebug, 'headers' => [ 'Content-Type' => 'application/json', 'Cache-Control' => 'no-cache'