From 045125da9a01fdc4d73cc77ce29c3407f308d4bd Mon Sep 17 00:00:00 2001 From: Theo Mathieu Date: Fri, 19 Sep 2025 11:33:04 +0200 Subject: [PATCH 1/2] feat: allow security protocol --- .docs/server-config.md | 4 ++++ kafkabase/kafka_config.go | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/.docs/server-config.md b/.docs/server-config.md index 57e7f147..664241bd 100644 --- a/.docs/server-config.md +++ b/.docs/server-config.md @@ -99,6 +99,10 @@ Skip SSL verification of kafka server certificate. Kafka authorization as JSON object `{"mechanism": "SCRAM-SHA-256|PLAIN", "username": "user", "password": "password"}` +### `BULKER_KAFKA_SECURITY_PROTOCOL` + +Allow to pass security.protocol + ## Batching diff --git a/kafkabase/kafka_config.go b/kafkabase/kafka_config.go index b793dfd0..0c29620e 100644 --- a/kafkabase/kafka_config.go +++ b/kafkabase/kafka_config.go @@ -15,6 +15,7 @@ type KafkaConfig struct { KafkaSSLSkipVerify bool `mapstructure:"KAFKA_SSL_SKIP_VERIFY" default:"false"` KafkaSSLCA string `mapstructure:"KAFKA_SSL_CA"` KafkaSSLCAFile string `mapstructure:"KAFKA_SSL_CA_FILE"` + KafkaSecurityProtocol string `mapstructure:"KAFKA_SECURITY_PROTOCOL"` // Kafka authorization as JSON object {"mechanism": "SCRAM-SHA-256|PLAIN", "username": "user", "password": "password"} KafkaSASL string `mapstructure:"KAFKA_SASL"` @@ -48,7 +49,7 @@ type KafkaConfig struct { ProducerBatchSize int `mapstructure:"PRODUCER_BATCH_SIZE" default:"65535"` ProducerLingerMs int `mapstructure:"PRODUCER_LINGER_MS" default:"1000"` ProducerWaitForDeliveryMs int `mapstructure:"PRODUCER_WAIT_FOR_DELIVERY_MS" default:"1000"` - + // Failover logger configuration FailoverLoggerEnvConfig `mapstructure:",squash"` } @@ -91,6 +92,10 @@ func (ac *KafkaConfig) GetKafkaConfig() *kafka.ConfigMap { } } + if ac.KafkaSecurityProtocol != "" { + _ = kafkaConfig.SetKey("security.protocol", ac.KafkaSecurityProtocol) + } + return kafkaConfig } From 519168b05f400184ef3a811648757f58b72ace6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20Mathieu?= Date: Fri, 19 Sep 2025 11:27:50 -0700 Subject: [PATCH 2/2] Update .docs/server-config.md Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com> --- .docs/server-config.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.docs/server-config.md b/.docs/server-config.md index 664241bd..30ce3693 100644 --- a/.docs/server-config.md +++ b/.docs/server-config.md @@ -101,7 +101,7 @@ Kafka authorization as JSON object `{"mechanism": "SCRAM-SHA-256|PLAIN", "userna ### `BULKER_KAFKA_SECURITY_PROTOCOL` -Allow to pass security.protocol +Allows setting Kafka `security.protocol` ## Batching