Skip to content

Commit 088a8c6

Browse files
committed
Update config TLS field to be Optional
1 parent 84b184f commit 088a8c6

File tree

3 files changed

+8
-10
lines changed

3 files changed

+8
-10
lines changed

temporalio/bridge/sdk-core

Submodule sdk-core updated 106 files

temporalio/envconfig.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
class ClientConfigTLSDict(TypedDict, total=False):
2525
"""Dictionary representation of TLS config for TOML."""
2626

27-
disabled: bool
27+
disabled: Optional[bool]
2828
server_name: str
2929
server_ca_cert: Mapping[str, str]
3030
client_cert: Mapping[str, str]
@@ -105,8 +105,8 @@ class ClientConfigTLS:
105105
Experimental API.
106106
"""
107107

108-
disabled: bool = False
109-
"""If true, TLS is explicitly disabled."""
108+
disabled: Optional[bool] = None
109+
"""If True, TLS is explicitly disabled. If False, TLS is explicitly enabled. If None, TLS behavior was not configured."""
110110
server_name: Optional[str] = None
111111
"""SNI override."""
112112
server_root_ca_cert: Optional[DataSource] = None
@@ -119,7 +119,7 @@ class ClientConfigTLS:
119119
def to_dict(self) -> ClientConfigTLSDict:
120120
"""Convert to a dictionary that can be used for TOML serialization."""
121121
d: ClientConfigTLSDict = {}
122-
if self.disabled:
122+
if self.disabled is not None:
123123
d["disabled"] = self.disabled
124124
if self.server_name is not None:
125125
d["server_name"] = self.server_name
@@ -138,7 +138,7 @@ def set_source(
138138

139139
def to_connect_tls_config(self) -> Union[bool, temporalio.service.TLSConfig]:
140140
"""Create a `temporalio.service.TLSConfig` from this profile."""
141-
if self.disabled:
141+
if self.disabled is True:
142142
return False
143143

144144
return temporalio.service.TLSConfig(
@@ -154,7 +154,7 @@ def from_dict(d: Optional[ClientConfigTLSDict]) -> Optional[ClientConfigTLS]:
154154
if not d:
155155
return None
156156
return ClientConfigTLS(
157-
disabled=d.get("disabled", False),
157+
disabled=d.get("disabled"),
158158
server_name=d.get("server_name"),
159159
# Note: Bridge uses snake_case, but TOML uses kebab-case which is
160160
# converted to snake_case. Core has server_ca_cert, client_key.

tests/test_envconfig.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,6 @@ def test_client_config_profile_to_from_dict():
519519
namespace="some-namespace",
520520
api_key="some-api-key",
521521
tls=ClientConfigTLS(
522-
disabled=False,
523522
server_name="some-server-name",
524523
server_root_ca_cert=b"ca-cert-data",
525524
client_cert=Path("/path/to/client.crt"),
@@ -530,7 +529,7 @@ def test_client_config_profile_to_from_dict():
530529

531530
profile_dict = profile.to_dict()
532531

533-
# Check dict representation. Note that disabled=False is not in the dict.
532+
# Check dict representation. Note that disabled=None is not in the dict.
534533
expected_dict = {
535534
"address": "some-address",
536535
"namespace": "some-namespace",
@@ -557,7 +556,6 @@ def test_client_config_profile_to_from_dict():
557556
namespace="some-namespace",
558557
api_key="some-api-key",
559558
tls=ClientConfigTLS(
560-
disabled=False,
561559
server_name="some-server-name",
562560
server_root_ca_cert="ca-cert-data", # Was bytes, now str
563561
client_cert=Path("/path/to/client.crt"),

0 commit comments

Comments
 (0)