Skip to content

Commit

Permalink
SSL support (#67)
Browse files Browse the repository at this point in the history
  • Loading branch information
radimvaculik authored Oct 3, 2023
1 parent 4f60fd2 commit 65c4a26
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 2 deletions.
19 changes: 19 additions & 0 deletions .docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,25 @@ tracy:
- Contributte\RabbitMQ\Diagnostics\BarPanel
```

#### SSL configuration

See examples in [jakubkulhan/bunny documentation](https://github.com/jakubkulhan/bunny/tree/master/examples/ssl).

```neon
rabbitmq:
connections:
default:
user: guest
password: guest
host: localhost
port: 5672
lazy: false
ssl:
cafile: 'ca.pem'
allow_self_signed: true
veirfy_peer: true
```

### Declaring Queues and Exchanges

Since v3.0, all queues and exchanges are by default declared on demand using the console command:
Expand Down
4 changes: 3 additions & 1 deletion src/Connection/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ public function __construct(
bool $persistent,
string $path,
bool $tcpNoDelay,
bool $lazy = false
bool $lazy = false,
?array $ssl = null
) {
$this->connectionParams = [
'host' => $host,
Expand All @@ -43,6 +44,7 @@ public function __construct(
'persistent' => $persistent,
'path' => $path,
'tcp_nodelay' => $tcpNoDelay,
'ssl' => $ssl,
];

$this->bunnyClient = $this->createNewConnection();
Expand Down
3 changes: 2 additions & 1 deletion src/Connection/ConnectionFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ private function create(string $name): IConnection
(bool) $connectionData['persistent'],
$connectionData['path'],
(bool) $connectionData['tcpNoDelay'],
(bool) $connectionData['lazy']
(bool) $connectionData['lazy'],
$connectionData['ssl'],

Check failure on line 63 in src/Connection/ConnectionFactory.php

View workflow job for this annotation

GitHub Actions / Quality assurance (7.4, ubuntu-latest)

Trailing comma after the last parameter in function call is disallowed.

Check failure on line 63 in src/Connection/ConnectionFactory.php

View workflow job for this annotation

GitHub Actions / Quality assurance (7.4, ubuntu-latest)

Trailing comma after the last parameter in function call is disallowed.

Check failure on line 63 in src/Connection/ConnectionFactory.php

View workflow job for this annotation

GitHub Actions / Quality assurance (7.4, ubuntu-latest)

Trailing comma after the last parameter in function call is disallowed.
);
}

Expand Down
1 change: 1 addition & 0 deletions src/DI/Helpers/ConnectionsHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ final class ConnectionsHelper extends AbstractHelper
'path' => '/',
'tcpNoDelay' => false,
'lazy' => false,
'ssl' => null,
];


Expand Down

0 comments on commit 65c4a26

Please sign in to comment.