100 lines
2.3 KiB
Go
100 lines
2.3 KiB
Go
package config
|
|
|
|
var (
|
|
SettingInfo = new(Setting)
|
|
SettingAreaInfo = make(map[string]map[string]string, 0)
|
|
)
|
|
|
|
// Mysql 配置
|
|
type Mysql struct {
|
|
Host string `yaml:"host"`
|
|
Port int `yaml:"port"`
|
|
User string `yaml:"user"`
|
|
Password string `yaml:"password"`
|
|
DBName string `yaml:"db_name"`
|
|
Parameters string `yaml:"parameters"`
|
|
}
|
|
|
|
// Sqlite 配置
|
|
type Sqlite struct {
|
|
Path string `yaml:"path"`
|
|
Name string `yaml:"name"`
|
|
}
|
|
|
|
// RPCServer RPC Server服务
|
|
type RPCServer struct {
|
|
Host string `yaml:"host"`
|
|
Port int `yaml:"port"`
|
|
IsTLS bool `yaml:"is_tls"`
|
|
TLSName string `yaml:"tls_name"`
|
|
Pem string `yaml:"pem"`
|
|
Key string `yaml:"key"`
|
|
}
|
|
|
|
// Redis 配置
|
|
type Redis struct {
|
|
Addr string `yaml:"addr"`
|
|
Password string `yaml:"password"`
|
|
DB int `yaml:"db"`
|
|
MaxActive int `yaml:"max_active"`
|
|
MaxIdle int `yaml:"max_idle"`
|
|
IdleTimeout int `yaml:"idle_timeout"`
|
|
}
|
|
|
|
// Setting 配置信息
|
|
type Setting struct {
|
|
Domain string `json:"domain" yaml:"domain"`
|
|
Name string `yaml:"name"`
|
|
TokenEffectTime int `yaml:"token_effect_time"`
|
|
MultipleLogin bool `yaml:"multiple_login"`
|
|
|
|
// Server 配置
|
|
Server struct {
|
|
Port int `yaml:"port"`
|
|
ReadTimeout int `yaml:"read_timeout"`
|
|
WriteTimeout int `yaml:"write_timeout"`
|
|
IdleTimeout int `yaml:"idle_timeout"`
|
|
}
|
|
|
|
// Rate 限流器
|
|
Rate struct {
|
|
Limit int `yaml:"limit"`
|
|
Capacity int `yaml:"capacity"`
|
|
}
|
|
|
|
// Engine 配置
|
|
Engine struct {
|
|
Debug bool `yaml:"debug"`
|
|
DBMode string `yaml:"db_mode"`
|
|
MaxLifetime int `yaml:"max_lifetime"`
|
|
MaxOpenConns int `yaml:"max_open_conns"`
|
|
MaxIdleConns int `yaml:"max_idle_conns"`
|
|
TablePrefix string `yaml:"table_prefix"`
|
|
Complex bool `yaml:"complex"`
|
|
Mysql *Mysql `yaml:"mysql"`
|
|
Sqlite *Sqlite `yaml:"sqlite"`
|
|
}
|
|
|
|
// Cache 缓存配置
|
|
Cache struct {
|
|
Type string `yaml:"type"`
|
|
Redis *Redis `yaml:"redis"`
|
|
}
|
|
|
|
// Upload 配置
|
|
Upload struct {
|
|
Path string `yaml:"path"`
|
|
Ext string `yaml:"ext"`
|
|
Exts []string `yaml:"-"`
|
|
Size int64 `yaml:"size"`
|
|
Rename bool `yaml:"rename"`
|
|
}
|
|
|
|
// Log 配置
|
|
Log struct {
|
|
File string `yaml:"file"`
|
|
LeastDay uint `yaml:"least_day"`
|
|
Level string `yaml:"level"`
|
|
}
|
|
}
|