Skip to content

Commit 4078190

Browse files
authored
Remove logic that auto adds TLS when api key is enabled (#1010)
1 parent 7ac63c5 commit 4078190

1 file changed

Lines changed: 0 additions & 32 deletions

File tree

core-api/src/envconfig.rs

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -358,9 +358,6 @@ pub fn load_client_config_profile(
358358
profile.load_from_env(env_vars)?;
359359
}
360360

361-
// Apply API key → TLS auto-enabling logic
362-
profile.apply_api_key_tls_logic();
363-
364361
Ok(profile)
365362
}
366363

@@ -528,14 +525,6 @@ impl ClientConfigProfile {
528525
}
529526
Ok(())
530527
}
531-
532-
/// Apply automatic TLS enabling when API key is present
533-
pub fn apply_api_key_tls_logic(&mut self) {
534-
if self.api_key.is_some() && self.tls.is_none() {
535-
// If API key is present but no TLS config exists, create one with TLS enabled
536-
self.tls = Some(ClientConfigTLS::default());
537-
}
538-
}
539528
}
540529

541530
/// Helper to check if any of the given environment variables are set.
@@ -1582,27 +1571,6 @@ address = "localhost:7233"
15821571
assert_eq!(profile.namespace.as_ref().unwrap(), "env-namespace");
15831572
}
15841573

1585-
#[test]
1586-
fn test_api_key_tls_auto_enable() {
1587-
// Test 1: When API key is present, TLS should be automatically enabled
1588-
let toml_str = r#"
1589-
[profile.default]
1590-
api_key = "my-api-key"
1591-
"#;
1592-
1593-
let options = LoadClientConfigProfileOptions {
1594-
config_source: Some(DataSource::Data(toml_str.as_bytes().to_vec())),
1595-
..Default::default()
1596-
};
1597-
1598-
let profile = load_client_config_profile(options, None).unwrap();
1599-
1600-
// TLS should be enabled due to API key presence
1601-
assert!(profile.tls.is_some());
1602-
let tls = profile.tls.as_ref().unwrap();
1603-
assert_eq!(tls.disabled, None); // Not explicitly set
1604-
}
1605-
16061574
#[test]
16071575
fn test_no_api_key_no_tls_is_none() {
16081576
// Test that if no API key is present and no TLS block exists, TLS config is None

0 commit comments

Comments
 (0)