Skip to content

Commit

Permalink
Remove TLS related options when not using TLS
Browse files Browse the repository at this point in the history
  • Loading branch information
Olivier Dolbeau committed Jun 7, 2021
1 parent d4844ef commit 89e2d1d
Showing 1 changed file with 4 additions and 0 deletions.
Expand Up @@ -219,6 +219,10 @@ public static function fromDsn(string $dsn, array $options = [], AmqpFactory $am
return $queueOptions;
}, $queuesOptions);

if (!$useAmqps) {
unset($amqpOptions['cacert'], $amqpOptions['cert'], $amqpOptions['key'], $amqpOptions['verify']);
}

if ($useAmqps && !self::hasCaCertConfigured($amqpOptions)) {
throw new InvalidArgumentException('No CA certificate has been provided. Set "amqp.cacert" in your php.ini or pass the "cacert" parameter in the DSN to use SSL. Alternatively, you can use amqp:// to use without SSL.');
}
Expand Down

0 comments on commit 89e2d1d

Please sign in to comment.