kafka.go
480 字节
package constant
import (
"os"
"strings"
)
type KafkaConfig struct {
Servers []string `json:"servers"`
ConsumerId string `json:"consumerGroup"`
}
var KafkaCfg KafkaConfig
func init() {
KafkaCfg = KafkaConfig{
Servers: []string{"106.52.15.41:9092"},
ConsumerId: "partnermg",
}
if os.Getenv("KAFKA_HOST") != "" {
kafkaHost := os.Getenv("KAFKA_HOST")
KafkaCfg.Servers = strings.Split(kafkaHost, ";")
}
}
// "192.168.190.136:9092",
// "106.52.15.41:9092"