Skip to content

Commit

Permalink
feat: add SASL and TLS config
Browse files Browse the repository at this point in the history
  • Loading branch information
WenyXu committed Aug 9, 2024
1 parent 0d70961 commit 0e7701b
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/common/wal/src/config/kafka/datanode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,29 @@ pub struct DatanodeKafkaConfig {
/// The kafka topic config.
#[serde(flatten)]
pub kafka_topic: KafkaTopicConfig,
/// Client SASL.
pub sasl: Option<KafkaClientSasl>,
/// Client TLS config
pub tls: Option<KafkaClientTls>,
}

#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
pub struct KafkaClientSasl {
#[serde(flatten)]
pub config: Option<KafkaClientSaslConfig>,
}

#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
#[serde(tag = "type")]
pub enum KafkaClientSaslConfig {
Plain { username: String, password: String },
}

#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
pub struct KafkaClientTls {
server_ca_cert_path: String,
client_cert_path: String,
client_key_path: String,
}

impl Default for DatanodeKafkaConfig {
Expand All @@ -50,6 +73,8 @@ impl Default for DatanodeKafkaConfig {
consumer_wait_timeout: Duration::from_millis(100),
backoff: BackoffConfig::default(),
kafka_topic: KafkaTopicConfig::default(),
sasl: None,
tls: None,
}
}
}

0 comments on commit 0e7701b

Please sign in to comment.