Skip to content

Commit c858c80

Browse files
committed
fix: Create default TLS config is API key is exposed
1 parent ed978bd commit c858c80

File tree

2 files changed

+863
-1
lines changed

2 files changed

+863
-1
lines changed

src/Common/EnvConfig/Client/ConfigProfile.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ final class ConfigProfile
4949
* @var array<non-empty-lowercase-string, list<string>>
5050
*/
5151
public readonly array $grpcMeta;
52+
public readonly ?ConfigTls $tlsConfig;
5253

5354
/**
5455
* Construct a new configuration profile.
@@ -69,14 +70,16 @@ public function __construct(
6970
?string $address,
7071
?string $namespace,
7172
null|string|\Stringable $apiKey,
72-
public readonly ?ConfigTls $tlsConfig = null,
73+
?ConfigTls $tlsConfig = null,
7374
array $grpcMeta = [],
7475
public readonly ?ConfigCodec $codecConfig = null,
7576
) {
7677
// Normalize empty strings to null
7778
$this->address = $address === '' ? null : $address;
7879
$this->namespace = $namespace === '' ? null : $namespace;
7980
$this->apiKey = $apiKey === '' ? null : $apiKey;
81+
// If TLS config not provided, create default if API key is set
82+
$this->tlsConfig = $tlsConfig ?? ($this->apiKey === null ? null : new ConfigTls());
8083

8184
// Normalize gRPC metadata keys to lowercase per gRPC spec
8285
$meta = [];

0 commit comments

Comments
 (0)