| | |
| | | EsUrl string `mapstructure: "esUrl"` |
| | | ServerUrl string `mapstructure: "serverUrl"` |
| | | OrgName string `mapstructure: "orgName"` |
| | | Interval int `mapstructure:"pushInterval"` |
| | | } |
| | | |
| | | type logConfig struct { |
| | | Path string `mapstructure:"path"` //日志存储路径 |
| | | Level int `mapstructure:"level"` //日志等级 |
| | | MaxSize int `mapstructure:"maxSize"` //日志文件大小上限 |
| | | MaxBackups int `mapstructure:"maxBackups"` //日志压缩包个数 |
| | | MaxAge int `mapstructure:"maxAge"` //保留压缩包天数 |
| | | } |
| | | |
| | | var Options = &common{} |
| | | var LogConf = &logConfig{} |
| | | |
| | | func Init() { |
| | | var err error |
| | |
| | | } |
| | | |
| | | viper.UnmarshalKey("common", Options) |
| | | viper.UnmarshalKey("log", LogConf) |
| | | |
| | | viper.WatchConfig() |
| | | viper.OnConfigChange(func(in fsnotify.Event) { |
| | | viper.UnmarshalKey("common", Options) |