Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 0 additions & 32 deletions core-api/src/envconfig.rs
Original file line number Diff line number Diff line change
Expand Up @@ -358,9 +358,6 @@ pub fn load_client_config_profile(
profile.load_from_env(env_vars)?;
}

// Apply API key → TLS auto-enabling logic
profile.apply_api_key_tls_logic();

Ok(profile)
}

Expand Down Expand Up @@ -528,14 +525,6 @@ impl ClientConfigProfile {
}
Ok(())
}

/// Apply automatic TLS enabling when API key is present
pub fn apply_api_key_tls_logic(&mut self) {
if self.api_key.is_some() && self.tls.is_none() {
// If API key is present but no TLS config exists, create one with TLS enabled
self.tls = Some(ClientConfigTLS::default());
}
}
}

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

#[test]
fn test_api_key_tls_auto_enable() {
// Test 1: When API key is present, TLS should be automatically enabled
let toml_str = r#"
[profile.default]
api_key = "my-api-key"
"#;

let options = LoadClientConfigProfileOptions {
config_source: Some(DataSource::Data(toml_str.as_bytes().to_vec())),
..Default::default()
};

let profile = load_client_config_profile(options, None).unwrap();

// TLS should be enabled due to API key presence
assert!(profile.tls.is_some());
let tls = profile.tls.as_ref().unwrap();
assert_eq!(tls.disabled, None); // Not explicitly set
}

#[test]
fn test_no_api_key_no_tls_is_none() {
// Test that if no API key is present and no TLS block exists, TLS config is None
Expand Down
Loading