conf

package
v0.0.85 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AllowOrigin []string
View Source
var Es = EsConf{}
View Source
var HttpPort int
View Source
var LogColorful = false
View Source
var LogLevel = "DEBUG"

log conf

View Source
var LogResponseLength int
View Source
var LogShowSql = true
View Source
var MySql = MysqlConf{}
View Source
var Redis = RedisConf{}
View Source
var ServerName string

Base conf

Functions

func BaseConfig

func BaseConfig(conf Config)

Types

type Config

type Config struct {
	ServerName        string
	Env               string
	HttpPort          int
	LogLevel          string
	LogColorful       bool
	LogResponseLength int
	LogShowSql        bool
	AllowOrigin       []string
	Redis             RedisConf

	Elasticsearch EsConf

	Mysql MysqlConf
}

type EsConf

type EsConf struct {
	ServerHost         string
	ServerPort         int
	Sniff              bool
	LogType            int //1、只记录用户操作,2、只记录非用户操作,3全记录
	LogIndexNamePrefix string
	UnLogUrls          []string
	CloseClearHisLog   bool   //是否关闭清理历史日志
	ClearHisLogSpec    string //清理历史日志的定时时间配置
	StoreDays          int    //日志存放天数
	CheckDuration      int    //检查间隔时间

}

ES conf

type MysqlConf

type MysqlConf struct {
	Host         string
	Port         int
	User         string
	Password     string
	NameSpace    string
	MaxIdleConns int
	MaxOpenConns int
}

Mysql conf

type RedisConf

type RedisConf struct {
	RedisHost    string
	RedisPort    int
	RedisPwd     string
	RedisDb      int
	ReadTimeout  int //取超时间 单位秒 默认值为3秒
	WriteTimeout int // 写入超时时间 单位秒 默认与读超时时间一致
	PoolSize     int //最大连接数 默认cpu数*10
	MinIdleConns int //最小空闲连接数
}

Redis conf

Jump to

Keyboard shortcuts

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