@@ -43,11 +43,11 @@ func (config *AuthenticationConfig) SetConfiguration(saramaConfig *sarama.Config
43
43
if strings .Trim (authentication , " " ) == "" {
44
44
authentication = none
45
45
}
46
- if config .Authentication == tls || ! config .TLS .Insecure {
47
- if err := setTLSConfiguration (& config .TLS , saramaConfig , logger ); err != nil {
48
- return err
49
- }
50
- }
46
+ if config .Authentication == tls || ! config .TLS .Insecure {
47
+ if err := setTLSConfiguration (& config .TLS , saramaConfig , logger ); err != nil {
48
+ return err
49
+ }
50
+ }
51
51
52
52
switch authentication {
53
53
case none :
@@ -58,7 +58,7 @@ func (config *AuthenticationConfig) SetConfiguration(saramaConfig *sarama.Config
58
58
setKerberosConfiguration (& config .Kerberos , saramaConfig )
59
59
return nil
60
60
case plaintext :
61
- return setPlainTextConfiguration (& config .PlainText , saramaConfig )
61
+ return setPlainTextConfiguration (& config .PlainText , saramaConfig )
62
62
default :
63
63
return fmt .Errorf ("Unknown/Unsupported authentication method %s to kafka cluster" , config .Authentication )
64
64
}
@@ -76,22 +76,22 @@ func (config *AuthenticationConfig) InitFromViper(configPrefix string, v *viper.
76
76
config .Kerberos .KeyTabPath = v .GetString (configPrefix + kerberosPrefix + suffixKerberosKeyTab )
77
77
config .Kerberos .DisablePAFXFast = v .GetBool (configPrefix + kerberosPrefix + suffixKerberosDisablePAFXFAST )
78
78
79
- if config .Authentication == tls || v .GetBool (configPrefix + ".tls.enabled" ){
80
- tlsClientConfig := tlscfg.ClientFlagsConfig {
81
- Prefix : configPrefix ,
82
- }
83
- tlsCfg , err := tlsClientConfig .InitFromViper (v )
84
- if err != nil {
85
- return fmt .Errorf ("failed to process Kafka TLS options: %w" , err )
86
- }
87
- config .TLS = tlsCfg
79
+ tlsEnabled := v .GetBool (configPrefix + ".tls.enabled" )
80
+ if config .Authentication == tls || v .GetBool (configPrefix + ".tls.enabled" ) {
81
+ tlsClientConfig := tlscfg.ClientFlagsConfig {
82
+ Prefix : configPrefix ,
83
+ }
84
+ tlsCfg , err := tlsClientConfig .InitFromViper (v )
85
+ if err != nil {
86
+ return fmt .Errorf ("failed to process Kafka TLS options: %w" , err )
87
+ }
88
+ config .TLS = tlsCfg
88
89
} else {
89
- // Explicitly set TLS to insecure when disabled
90
- config .TLS = configtls.ClientConfig {
91
- Insecure : true ,
92
- }
93
- }
94
-
90
+ // Explicitly set TLS to insecure when disabled
91
+ config .TLS = configtls.ClientConfig {
92
+ Insecure : true ,
93
+ }
94
+ }
95
95
96
96
config .PlainText .Username = v .GetString (configPrefix + plainTextPrefix + suffixPlainTextUsername )
97
97
config .PlainText .Password = v .GetString (configPrefix + plainTextPrefix + suffixPlainTextPassword )
0 commit comments