Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions pkg/amqp-bunny/AmqpConnectionFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,6 @@ public function getConfig(): ConnectionConfig

private function establishConnection(): BunnyClient
{
if ($this->config->isSslOn()) {
throw new \LogicException('The bunny library does not support SSL connections');
}

if (false == $this->client) {
$bunnyConfig = [];
$bunnyConfig['host'] = $this->config->getHost();
Expand All @@ -102,6 +98,20 @@ private function establishConnection(): BunnyClient
$bunnyConfig['tcp_nodelay'] = $this->config->getOption('tcp_nodelay');
}

if ($this->config->isSslOn()) {
$sslOptions = array_filter([
'cafile' => $this->config->getSslCaCert(),
'local_cert' => $this->config->getSslCert(),
'local_pk' => $this->config->getSslKey(),
'verify_peer' => $this->config->isSslVerify(),
'verify_peer_name' => $this->config->isSslVerify(),
'passphrase' => $this->getConfig()->getSslPassPhrase(),
'ciphers' => $this->config->getOption('ciphers', ''),
], function ($value) { return '' !== $value; });

$bunnyConfig['ssl'] = $sslOptions;
}

$this->client = new BunnyClient($bunnyConfig);
$this->client->connect();
}
Expand Down
Loading