Skip to content

Commit

Permalink
Fix ConnectionConfig: rename property tlsConfig to tls
Browse files Browse the repository at this point in the history
  • Loading branch information
roxblnfk committed Sep 2, 2024
1 parent 3b2734b commit 866f3c3
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 21 deletions.
8 changes: 4 additions & 4 deletions src/Bootloader/TemporalBridgeBootloader.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,10 @@ protected function initServiceClient(TemporalConfig $config): ServiceClientInter
$result = $connection->isSecure()
? ServiceClient::createSSL(
address: $connection->address,
crt: $connection->tlsConfig->rootCerts,
clientKey: $connection->tlsConfig->privateKey,
clientPem: $connection->tlsConfig->certChain,
overrideServerName: $connection->tlsConfig->serverName,
crt: $connection->tls->rootCerts,
clientKey: $connection->tls->privateKey,
clientPem: $connection->tls->certChain,
overrideServerName: $connection->tls->serverName,
)
: ServiceClient::create(address: $connection->address);

Expand Down
2 changes: 1 addition & 1 deletion src/Config/ClientConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* new ClientConfig(
* connection: new ConnectionConfig(
* address: 'localhost:7233',
* tlsConfig: new TlsConfig(
* tls: new TlsConfig(
* privateKey: '/my-project.key',
* certChain: '/my-project.pem',
* ),
Expand Down
14 changes: 7 additions & 7 deletions src/Config/ConnectionConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*
* How to connect to local Temporal server:
*
* ConnectionConfig::new('localhost:7233'),
* new ConnectionConfig('localhost:7233'),
*
* How to connect to Temporal Cloud:
*
Expand All @@ -23,24 +23,24 @@ final class ConnectionConfig
{
/**
* @param non-empty-string $address Address of the Temporal service.
* @param TlsConfig|null $tlsConfig TLS configuration for the connection.
* @param TlsConfig|null $tls TLS configuration for the connection.
* @param non-empty-string|\Stringable|null $authToken Authentication token for the service client.
*/
public function __construct(
public readonly string $address,
public readonly ?TlsConfig $tlsConfig = null,
public readonly ?TlsConfig $tls = null,
public readonly string|\Stringable|null $authToken = null,
) {}

/**
* Check if the connection is secure.
*
* @psalm-assert-if-true TlsConfig $this->tlsConfig
* @psalm-assert-if-false null $this->tlsConfig
* @psalm-assert-if-true TlsConfig $this->tls
* @psalm-assert-if-false null $this->tls
*/
public function isSecure(): bool
{
return $this->tlsConfig !== null;
return $this->tls !== null;
}

/**
Expand Down Expand Up @@ -78,7 +78,7 @@ public function withAuthKey(string|\Stringable|null $authToken): self
{
return new self(
$this->address,
$this->tlsConfig,
$this->tls,
$authToken,
);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/app/config/temporal.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
'ssl' => new ClientConfig(
new ConnectionConfig(
address: 'ssl:7233',
tlsConfig: new TlsConfig(
tls: new TlsConfig(
rootCerts: '/path/to/crt',
privateKey: '/path/to/clientKey',
certChain: '/path/to/clientPem',
Expand Down
8 changes: 4 additions & 4 deletions tests/src/Config/ConnectionConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ public function testCreateSecure(): void

$this->assertTrue($config->isSecure());
$this->assertSame('localhost:2222', $config->address);
$this->assertSame('crt', $config->tlsConfig->rootCerts);
$this->assertSame('clientKey', $config->tlsConfig->privateKey);
$this->assertSame('clientPem', $config->tlsConfig->certChain);
$this->assertSame('crt', $config->tls->rootCerts);
$this->assertSame('clientKey', $config->tls->privateKey);
$this->assertSame('clientPem', $config->tls->certChain);
}

public function testCreateInsecure(): void
Expand All @@ -40,7 +40,7 @@ public function testWithAuthKey(): void
{
$config = new ConnectionConfig(
address: 'localhost:1111',
tlsConfig: new TlsConfig(
tls: new TlsConfig(
certChain: 'clientPem',
)
);
Expand Down
8 changes: 4 additions & 4 deletions tests/src/Config/TemporalConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ public function testGetTlsConnection(): void

$this->assertTrue($connection->isSecure());
$this->assertSame('localhost:2222', $connection->address);
$this->assertSame('crt', $connection->tlsConfig->rootCerts);
$this->assertSame('clientKey', $connection->tlsConfig->privateKey);
$this->assertSame('clientPem', $connection->tlsConfig->certChain);
$this->assertSame('localhost', $connection->tlsConfig->serverName);
$this->assertSame('crt', $connection->tls->rootCerts);
$this->assertSame('clientKey', $connection->tls->privateKey);
$this->assertSame('clientPem', $connection->tls->certChain);
$this->assertSame('localhost', $connection->tls->serverName);
}

public function testGetsDefaultWorker(): void
Expand Down

0 comments on commit 866f3c3

Please sign in to comment.