mirror of
https://gitee.ltd/lxh/logger.git
synced 2026-09-03 00:14:29 +08:00
✨ 支持初始化的时候从环境变量读取配置信息
This commit is contained in:
13
config.go
13
config.go
@@ -11,12 +11,13 @@ var (
|
||||
|
||||
// LogConfig 日志配置
|
||||
type LogConfig struct {
|
||||
Mode mode // dev, prod
|
||||
LokiEnable bool
|
||||
FileEnable bool
|
||||
LokiHost string
|
||||
LokiPort int
|
||||
LokiName string // Loki的job和source名称
|
||||
Mode mode `env:"LOG_MODE"` // dev, prod
|
||||
LokiEnable bool `env:"LOG_LOKI_ENABLE"` // 是否启用Loki
|
||||
FileEnable bool `env:"LOG_FILE_ENABLE"` // 是否输出到文件
|
||||
LokiHost string `env:"LOG_LOKI_HOST"` // Loki地址
|
||||
LokiPort int `env:"LOG_LOKI_PORT"` // Loki端口
|
||||
LokiSource string `env:"LOG_LOKI_SOURCE_NAME"` // Loki的source名称
|
||||
LokiJob string `env:"LOG_LOKI_JOB_NAME"` // Loki的job名称
|
||||
}
|
||||
|
||||
func (c LogConfig) getLokiPushURL() string {
|
||||
|
||||
Reference in New Issue
Block a user