Skip to content

Commit bd232ef

Browse files
authored
Merge pull request #96 from nats-io/force-tls-option
Add SASL TLS option to always use tls
2 parents 93120f4 + 822c1de commit bd232ef

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

server/conf/conf.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,13 @@ type TLSConf struct {
8585
Root string
8686
}
8787

88-
// SASL holds the configuration for SASL authentication.
88+
// SASL holds the configuration for SASL authentication with Kafka.
8989
type SASL struct {
9090
User string
9191
Password string
9292
InsecureSkipVerify bool
9393
Mechanism string
94+
TLS bool
9495
}
9596

9697
// MakeTLSConfig creates a tls.Config from a TLSConf, setting up the key pairs and certs

server/kafka/producer.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,9 @@ func NewProducer(cc conf.ConnectorConfig, bc conf.NATSKafkaBridgeConfig, topic s
9696
sc.Net.TLS.Enable = true
9797
sc.Net.TLS.Config = tlsC
9898
}
99+
if cc.SASL.TLS {
100+
sc.Net.TLS.Enable = cc.SASL.TLS
101+
}
99102

100103
sp, err := sarama.NewSyncProducer(cc.Brokers, sc)
101104
if err != nil {

0 commit comments

Comments
 (0)