gofiber-study/common/config/config.go

46 lines
1.1 KiB
Go
Raw Normal View History

package config
type BasicConfig struct {
Server ServerConfig `yaml:"server"`
Mysql MysqlConfig `yaml:"mysql"`
2022-10-04 03:08:27 +08:00
Redis RedisConfig `yaml:"redis"`
Jwt JwtConfig `yaml:"jwt"`
2022-10-06 20:46:17 +08:00
NanoId NanoIdConfig `yaml:"nanoId"`
}
type NanoIdConfig struct {
Sequence string `yaml:"sequence"`
Length int `yaml:"length"`
}
type JwtConfig struct {
Secret string `yaml:"secret"`
Expire int64 `yaml:"expire"`
}
type MysqlConfig struct {
DataSources []string `yaml:"dataSources"`
AutoSync bool `yaml:"autoSync"`
}
type ServerConfig struct {
// 监听 地址:端口
Addr string `yaml:"addr"`
// 是否开启多进程
PreFork bool `yaml:"preFork"`
// 路由 大小写严格
CaseSensitive bool `yaml:"caseSensitive"`
// 严格路由 例: 设置为 true 时, /foo != /foo/
StrictRouting bool `yaml:"strictRouting"`
// 设置 Http 请求头中的 Server 名称
ServerHeader string `yaml:"serverHeader"`
// 是否添加 /routes 路由 用于获取所有路由信息
EnableRoutesMsg bool `yaml:"enableRoutesMsg"`
}
type RedisConfig struct {
Addr string `yaml:"addr"`
Pass string `yaml:"pass"`
2022-10-04 03:08:27 +08:00
DB int `yaml:"db"`
}