From 0bd97fb5e5586744dd7c6fa76ca743da3298b494 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Felix?= <3254497+le-yak@users.noreply.github.com> Date: Sun, 7 Nov 2021 09:39:44 +0100 Subject: [PATCH] fix: properly load SSL configuration (#77) * 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 --- src/Amqp/Connection.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/Amqp/Connection.php b/src/Amqp/Connection.php index 1fd914e..b376bd8 100644 --- a/src/Amqp/Connection.php +++ b/src/Amqp/Connection.php @@ -64,6 +64,7 @@ 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'), @@ -71,16 +72,16 @@ protected function makeFactory(): AmqpConnectionFactory '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; }