config

package
v1.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 7, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddViperUnmarshal

func AddViperUnmarshal(fileName string, conf IConfig, onChange OnConfigChangeFn, decoderConfigOpts ...viper.DecoderConfigOption)

Types

type AppConfImpl

type AppConfImpl struct {
	FileName   string
	AppPath    string
	Port       int
	Logging    *LoggingOpt
	Cors       *CorsOpt
	ErrorCatch *ErrorCatchOpt
	RspCueTpl  *RspCueTplOpt // http响应结构的cue模板
}
var AppConf AppConfImpl

AppConf 配置中心

func (*AppConfImpl) InitDefaultConfig

func (this *AppConfImpl) InitDefaultConfig(vp *viper.Viper)

type CorsOpt

type CorsOpt struct {
	Enable bool
}

type ErrorCatchOpt

type ErrorCatchOpt struct {
	Enable bool
}

type IConfig

type IConfig interface {
	// InitDefaultConfig 初始化配置默认值
	InitDefaultConfig(vp *viper.Viper)
}

type LogFileOpt

type LogFileOpt struct {
	FilePath   string // 输出文件目录
	MaxSize    int    // 日志大小限制,单位MB
	MaxAge     int    // 历史日志文件保留天数
	MaxBackups int    // 最大保留历史日志数量
}

type LoggingOpt

type LoggingOpt struct {
	RequestLogEnable bool // 是否开启http访问日志
	LogAccess        *LogFileOpt
	LogError         *LogFileOpt
}

type OnConfigChangeFn

type OnConfigChangeFn func(vp *viper.Viper) OnConfigChangeRunFn

type OnConfigChangeRunFn

type OnConfigChangeRunFn func(in fsnotify.Event)

type RspCueTplOpt added in v1.0.9

type RspCueTplOpt struct {
	ErrorTpl string // 错误的cue模板
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL