kafka.go 710 字节
package constant

import "os"

// KAFKA_HOSTS kafka 地址
var KAFKA_HOSTS = "192.168.0.250:9092,192.168.0.251:9092,192.168.0.252:9092"

// TOPIC_LOG_STASH kafka  topic log stash
var TOPIC_LOG_STASH = "go_stash_dev"

// ENABLE_KAFKA_LOG 是否启用日志收集 (本地不启用)
var ENABLE_KAFKA_LOG = false

func init() {
	if os.Getenv("KAFKA_HOSTS") != "" {
		KAFKA_HOSTS = os.Getenv("KAFKA_HOSTS")
	}
	if os.Getenv("TOPIC_LOG_STASH") != "" {
		POSTGRESQL_PORT = os.Getenv("TOPIC_LOG_STASH")
	}
	if os.Getenv("ENABLE_KAFKA_LOG") != "" {
		if os.Getenv("ENABLE_KAFKA_LOG") == "true" {
			ENABLE_KAFKA_LOG = true
		} else if os.Getenv("ENABLE_KAFKA_LOG") == "false" {
			ENABLE_KAFKA_LOG = false
		}
	}
}