package config import ( "fmt" "gateway/utils" ) // Loki配置信息 type lokiConfig struct { Host string Port string Source string } // InitLokiConfig 初始化Loki配置 func InitLokiConfig() { host := utils.GetEnvVal("LOKI_HOST", "") port := utils.GetEnvVal("LOKI_PORT", "") source := utils.GetEnvVal("LOKI_SOURCE", "goweb") LokiConfig = lokiConfig{Host: host, Port: port, Source: source} } // GetPushURL 获取组装后的日志推送接口 func (c lokiConfig) GetPushURL() string { return fmt.Sprintf("http://%v:%v/loki/api/v1/push", c.Host, c.Port) }