Skip to content

Commit 7ee0064

Browse files
committed
fix: Create default TLS config is API key is exposed
1 parent 250691f commit 7ee0064

File tree

2 files changed

+864
-1
lines changed

2 files changed

+864
-1
lines changed

src/Common/EnvConfig/Client/ConfigProfile.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ final class ConfigProfile
5050
*/
5151
public readonly array $grpcMeta;
5252

53+
public readonly ?ConfigTls $tlsConfig;
54+
5355
/**
5456
* Construct a new configuration profile.
5557
*
@@ -69,14 +71,16 @@ public function __construct(
6971
?string $address,
7072
?string $namespace,
7173
null|string|\Stringable $apiKey,
72-
public readonly ?ConfigTls $tlsConfig = null,
74+
?ConfigTls $tlsConfig = null,
7375
array $grpcMeta = [],
7476
public readonly ?ConfigCodec $codecConfig = null,
7577
) {
7678
// Normalize empty strings to null
7779
$this->address = $address === '' ? null : $address;
7880
$this->namespace = $namespace === '' ? null : $namespace;
7981
$this->apiKey = $apiKey === '' ? null : $apiKey;
82+
// If TLS config not provided, create default if API key is set
83+
$this->tlsConfig = $tlsConfig ?? ($this->apiKey === null ? null : new ConfigTls());
8084

8185
// Normalize gRPC metadata keys to lowercase per gRPC spec
8286
$meta = [];

0 commit comments

Comments
 (0)