diff --git a/src-tauri/src/configuration.rs b/src-tauri/src/configuration.rs index 5921fdfc..b3d2562d 100644 --- a/src-tauri/src/configuration.rs +++ b/src-tauri/src/configuration.rs @@ -22,16 +22,21 @@ pub struct Cluster { pub name: String, pub endpoint: String, pub authentication: Authentication, - pub schemaRegistry: Option, + #[serde(rename = "schemaRegistry")] + pub schema_registry: Option, } #[derive(Serialize, Deserialize, Debug, Clone)] pub enum Authentication { Ssl { - caLocation: String, - certificateLocation: String, - keyLocation: String, - keyPassword: Option, + #[serde(rename = "caLocation")] + ca_location: String, + #[serde(rename = "certificateLocation")] + certificate_location: String, + #[serde(rename = "keyLocation")] + key_location: String, + #[serde(rename = "keyPassword")] + key_password: Option, }, Sasl { username: String, diff --git a/src-tauri/src/kafka.rs b/src-tauri/src/kafka.rs index 0736c03e..24c4f6b7 100644 --- a/src-tauri/src/kafka.rs +++ b/src-tauri/src/kafka.rs @@ -25,12 +25,23 @@ fn create_consumer(cluster: &Cluster) -> Result { .set("sasl.username", username) .set("sasl.password", password); } + crate::configuration::Authentication::Ssl { - caLocation, - certificateLocation, - keyLocation, - keyPassword, - } => todo!(), + ca_location, + certificate_location, + key_location, + key_password, + } => { + config + .set("security.protocol", "ssl") + .set("ssl.ca.location", ca_location) + .set("ssl.certificate.location", certificate_location) + .set("ssl.key.location", key_location); + + if let Some(password) = key_password { + config.set("ssl.key.password", password); + } + } } config.create().map_err(|err| format!("Unable to build the Kafka consumer. {}", err)) } diff --git a/src/pages/clusters/form.tsx b/src/pages/clusters/form.tsx index 082875ee..eded1cfc 100644 --- a/src/pages/clusters/form.tsx +++ b/src/pages/clusters/form.tsx @@ -98,7 +98,8 @@ export const ClusterForm = ({ onSubmit, initialValues }: ClusterFormProps) => { }); return (
- + {/* padding required to avoid to have the scroll bar on top of the password eye */} +