1 Star 0 Fork 1

CHUAN / go-scaffold

forked from Allen / go-scaffold 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
base.go 1.36 KB
一键复制 编辑 原始数据 按行查看 历史
Allen 提交于 2021-06-11 11:32 . update mysql config
package conf
// Config instance with default value in global use
var Config = &MyConfig{
Name: "APP",
LogFile: "./logs/run.log",
EnableDebug: true,
EnableRedis: false,
EnableMySQL: false,
}
// MyConfig export
type MyConfig struct {
Name string
LogFile string
// SSL file path
EnableDebug bool
EnableRedis bool
EnableMySQL bool
RedisConfig RedisConfig
MySQLConfig MySQLConfig
ServerConfig ServerConfig
}
// RedisConfig struct
type RedisConfig struct {
Host string `default:"127.0.0.1"`
Port string `default:"6379"`
MaxIdle int
MaxActive int
Password string
Db int `default:"0"`
// timeout millisecond
ConnectionTimeout int `default:"30000"`
// timeout millisecond
ReadTimeout int `default:"5000"`
// timeout millisecond
WriteTimeout int `default:"5000"`
// timeout second
IdleTimeout int `default:"300"`
}
// MySQLConfig class
type MySQLConfig struct {
Host string `default:"127.0.0.1"`
Port string `default:"3306"`
Name string
Username string
Password string
// connection pool
MaxOpenConns int
MaxIdleConns int
// seconds of maximum amount a connection may be reused
ConnMaxLifetime int
Charset string
// seconds
Timeout int
}
// ServerConfig struct
type ServerConfig struct {
Host string
Port int
SSLName string
SSLCrtFile string
SSLKeyFile string
}
Go
1
https://gitee.com/chuanmension/go-scaffold.git
git@gitee.com:chuanmension/go-scaffold.git
chuanmension
go-scaffold
go-scaffold
v1.0.8

搜索帮助

53164aa7 5694891 3bd8fe86 5694891