File tree 2 files changed +16
-5
lines changed
2 files changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -103,12 +103,14 @@ The Kafka configuration contains the following key
103
103
| compression | none | VFLOW_KAFKA_COMPRESSION | compression codecs: gzip, snappy, lz4 |
104
104
| retry-max | 2 | VFLOW_KAFKA_RETRY_MAX | the total number of times to retry |
105
105
| request-size-max | 104857600 | VFLOW_KAFKA_REQUEST_SIZE_MAX | the maximum size (in bytes) of any request that will be attempted to send to Kafka |
106
- | retry-backoff | 10 | VFLOW_KAFKA_RETRY_BACKOFF | wait for leader election to occur before retrying in milliseconds |
107
- | tls-enabled | false | VFLOW_KAFKA_TLS_ENABLED | connect using TLS |
106
+ | retry-backoff | 10 | VFLOW_KAFKA_RETRY_BACKOFF | wait for leader election to occur before retrying in milliseconds |
107
+ | tls-enabled | false | VFLOW_KAFKA_TLS_ENABLED | connect using TLS |
108
108
| tls-cert | none | VFLOW_KAFKA_TLS_CERT | certificate file for client authentication |
109
109
| tls-key | none | VFLOW_KAFKA_TLS_KEY | key file for client authentication |
110
110
| ca-file | none | VFLOW_KAFKA_CA_FILE | certificate authority file for TLS client authentication |
111
- | tls-skip-verify | true | VFLOW_KAFKA_TLS_SKIP_VERIFY | if true, the server's certificate will not validate |
111
+ | tls-skip-verify | true | VFLOW_KAFKA_TLS_SKIP_VERIFY | if true, the server's certificate will not validate |
112
+ | sasl-username | none | VFLOW_KAFKA_SASL_USERNAME | username for SASL authentication |
113
+ | sasl-username | none | VFLOW_KAFKA_SASL_PASSWORD | password for SASL authentication |
112
114
113
115
## Example
114
116
```
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ import (
34
34
"time"
35
35
36
36
"github.com/Shopify/sarama"
37
- "gopkg.in/yaml.v2"
37
+ yaml "gopkg.in/yaml.v2"
38
38
)
39
39
40
40
// KafkaSarama represents kafka producer
@@ -55,7 +55,9 @@ type KafkaSaramaConfig struct {
55
55
TLSCertFile string `yaml:"tls-cert" env:"TLS_CERT"`
56
56
TLSKeyFile string `yaml:"tls-key" env:"TLS_KEY"`
57
57
CAFile string `yaml:"ca-file" env:"CA_FILE"`
58
- TLSSkipVerify bool `yaml:"tls-skip-verify" env:"TLS-SKIP-VERIFY"`
58
+ TLSSkipVerify bool `yaml:"tls-skip-verify" env:"TLS_SKIP_VERIFY"`
59
+ SASLUsername string `yaml:"sasl-username" env:"SASL_USERNAME"`
60
+ SASLPassword string `yaml:"sasl-password" env:"SASL_PASSWORD"`
59
61
}
60
62
61
63
func (k * KafkaSarama ) setup (configFile string , logger * log.Logger ) error {
@@ -109,6 +111,13 @@ func (k *KafkaSarama) setup(configFile string, logger *log.Logger) error {
109
111
}
110
112
}
111
113
114
+ // Enable SASL Auth Config if username is filled
115
+ if k .config .SASLUsername != "" {
116
+ config .Net .SASL .Enable = true
117
+ config .Net .SASL .User = k .config .SASLUsername
118
+ config .Net .SASL .Password = k .config .SASLPassword
119
+ }
120
+
112
121
// get env config
113
122
k .loadEnv ("VFLOW_KAFKA" )
114
123
You can’t perform that action at this time.
0 commit comments