Skip to content

Commit 45185b3

Browse files
committed
Merge remote-tracking branch 'origin/main' into openai/mcp
2 parents 5f7c644 + 0e1fa4f commit 45185b3

File tree

3 files changed

+442
-35
lines changed

3 files changed

+442
-35
lines changed

temporalio/bridge/src/envconfig.rs

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -89,19 +89,14 @@ fn load_client_config_inner(
8989
py: Python,
9090
config_source: Option<DataSource>,
9191
config_file_strict: bool,
92-
disable_file: bool,
9392
env_vars: Option<HashMap<String, String>>,
9493
) -> PyResult<PyObject> {
95-
let core_config = if disable_file {
96-
CoreClientConfig::default()
97-
} else {
98-
let options = LoadClientConfigOptions {
99-
config_source,
100-
config_file_strict,
101-
};
102-
core_load_client_config(options, env_vars.as_ref())
103-
.map_err(|e| ConfigError::new_err(format!("{e}")))?
94+
let options = LoadClientConfigOptions {
95+
config_source,
96+
config_file_strict,
10497
};
98+
let core_config = core_load_client_config(options, env_vars.as_ref())
99+
.map_err(|e| ConfigError::new_err(format!("{e}")))?;
105100

106101
core_config_to_dict(py, &core_config)
107102
}
@@ -130,12 +125,11 @@ fn load_client_connect_config_inner(
130125
}
131126

132127
#[pyfunction]
133-
#[pyo3(signature = (path, data, disable_file, config_file_strict, env_vars = None))]
128+
#[pyo3(signature = (path, data, config_file_strict, env_vars = None))]
134129
pub fn load_client_config(
135130
py: Python,
136131
path: Option<String>,
137132
data: Option<Vec<u8>>,
138-
disable_file: bool,
139133
config_file_strict: bool,
140134
env_vars: Option<HashMap<String, String>>,
141135
) -> PyResult<PyObject> {
@@ -153,7 +147,6 @@ pub fn load_client_config(
153147
py,
154148
config_source,
155149
config_file_strict,
156-
disable_file,
157150
env_vars,
158151
)
159152
}

temporalio/envconfig.py

Lines changed: 9 additions & 10 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.
@@ -238,7 +238,10 @@ def to_client_connect_config(self) -> ClientConnectConfig:
238238
config["namespace"] = self.namespace
239239
if self.api_key is not None:
240240
config["api_key"] = self.api_key
241+
# Enable TLS with default TLS options
242+
config["tls"] = True
241243
if self.tls is not None:
244+
# Use specified TLS options
242245
config["tls"] = self.tls.to_connect_tls_config()
243246
if self.grpc_meta:
244247
config["rpc_metadata"] = self.grpc_meta
@@ -333,7 +336,6 @@ def from_dict(
333336
def load(
334337
*,
335338
config_source: Optional[DataSource] = None,
336-
disable_file: bool = False,
337339
config_file_strict: bool = False,
338340
override_env_vars: Optional[Mapping[str, str]] = None,
339341
) -> ClientConfig:
@@ -348,8 +350,6 @@ def load(
348350
config_source: If present, this is used as the configuration source
349351
instead of default file locations. This can be a path to the file
350352
or the string/byte contents of the file.
351-
disable_file: If true, file loading is disabled. This is only used
352-
when ``config_source`` is not present.
353353
config_file_strict: If true, will TOML file parsing will error on
354354
unrecognized keys.
355355
override_env_vars: The environment variables to use for locating the
@@ -364,7 +364,6 @@ def load(
364364
loaded_profiles = _bridge_envconfig.load_client_config(
365365
path=path,
366366
data=data,
367-
disable_file=disable_file,
368367
config_file_strict=config_file_strict,
369368
env_vars=override_env_vars,
370369
)

0 commit comments

Comments
 (0)