generated from spiral-packages/package-skeleton
-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enhanced Temporal connection configuration for flexibility and SSL su…
…pport This commit significantly overhauls the Temporal connection configuration system. The previous configuration was limited to specifying a single Temporal address with no support for SSL connections. With the new setup, developers can now define multiple connection options, including SSL-enabled connections. Changes include: - Introduction of a 'connections' array to specify multiple connection types (e.g., `default`, `SSL`). - Addition of the `SslConnection` class to handle SSL connection parameters such as certificates and keys. - Preservation of backward compatibility by supporting the previous `address` configuration under the `default` connection type.
- Loading branch information
1 parent
38be446
commit 2d262ad
Showing
9 changed files
with
217 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Spiral\TemporalBridge\Connection; | ||
|
||
class Connection | ||
{ | ||
/** | ||
* @param non-empty-string $host | ||
* @param int $port | ||
*/ | ||
public function __construct( | ||
public readonly string $host, | ||
public readonly int $port, | ||
) { | ||
} | ||
|
||
public function getAddress(): string | ||
{ | ||
return $this->host . ':' . $this->port; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Spiral\TemporalBridge\Connection; | ||
|
||
class DsnConnection extends Connection | ||
{ | ||
public function __construct( | ||
public readonly string $address, | ||
) { | ||
[$host, $port] = \explode(':', $address); | ||
parent::__construct($host, (int)$port); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Spiral\TemporalBridge\Connection; | ||
|
||
final class SslConnection extends DsnConnection | ||
{ | ||
/** | ||
* @param non-empty-string $address | ||
* @param string $crt Full path to the certificate file (Default: '') | ||
* @param string|null $clientKey Full path to the client key file (Default: null) | ||
* @param string|null $clientPem Full path to the client pem file (Default: null) | ||
* @param string|null $overrideServerName | ||
*/ | ||
public function __construct( | ||
string $address, | ||
public readonly string $crt = '', | ||
public readonly ?string $clientKey = null, | ||
public readonly ?string $clientPem = null, | ||
public readonly ?string $overrideServerName = null, | ||
) { | ||
parent::__construct($address); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
use Spiral\TemporalBridge\Connection\DsnConnection; | ||
use Spiral\TemporalBridge\Connection\SslConnection; | ||
|
||
return [ | ||
'connection' => 'default', | ||
'connections' => [ | ||
'default' => new DsnConnection( | ||
address: 'localhost:7233', | ||
), | ||
'ssl' => new SslConnection( | ||
address: 'ssl:7233', | ||
crt: '/path/to/crt', | ||
clientKey: '/path/to/clientKey', | ||
clientPem: '/path/to/clientPem', | ||
overrideServerName: 'overrideServerName', | ||
), | ||
], | ||
]; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.