Skip to content

Commit

Permalink
fix: properly load SSL configuration (#77)
Browse files Browse the repository at this point in the history
* fix: properly load SSL configuration

Laravel's Collection::get() does not support dot notation

* fix: avoid useless array_merge

* fix: restore delayStrategy, deleted by mistake
  • Loading branch information
le-yak authored Nov 7, 2021
1 parent 9dc7ed4 commit 0bd97fb
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/Amqp/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,23 +64,24 @@ protected function makeTopic(AmqpContext $context): Topic
*/
protected function makeFactory(): AmqpConnectionFactory
{
$sslConfig = collect($this->config->get('ssl', []));
$factory = new AmqpConnectionFactory([
'dsn' => $this->config->get('dsn'),
'host' => $this->config->get('host', '127.0.0.1'),
'port' => $this->config->get('port', 5672),
'user' => $this->config->get('user', 'guest'),
'pass' => $this->config->get('pass', 'guest'),
'vhost' => $this->config->get('vhost', '/'),
'ssl_on' => $this->config->get('ssl.is_enabled', false),
'ssl_verify' => $this->config->get('ssl.verify_peer', true),
'ssl_cacert' => $this->config->get('ssl.cafile'),
'ssl_cert' => $this->config->get('ssl.local_cert'),
'ssl_key' => $this->config->get('ssl.local_key'),
'ssl_passphrase' => $this->config->get('ssl.passphrase'),
'ssl_on' => $sslConfig->get('is_enabled', false),
'ssl_verify' => $sslConfig->get('verify_peer', true),
'ssl_cacert' => $sslConfig->get('cafile'),
'ssl_cert' => $sslConfig->get('local_cert'),
'ssl_key' => $sslConfig->get('local_key'),
'ssl_passphrase' => $sslConfig->get('passphrase'),
]);

$factory->setDelayStrategy($this->getDelayStrategy());

return $factory;
}

Expand Down

0 comments on commit 0bd97fb

Please sign in to comment.