Files

69 lines
1.9 KiB
Go
Raw Permalink Normal View History

2022-11-28 16:38:30 +08:00
package config
// 组合全部配置模型
type Config struct {
Server Server `mapstructure:"server"`
Mysql Mysql `mapstructure:"mysql"`
Redis Redis `mapstructure:"redis"`
Jwt Jwt `mapstructure:"jwt"`
2022-12-27 19:22:38 +08:00
File File `mapstructure:"file"`
2022-11-28 16:38:30 +08:00
Mail Mail `mapstructure:"mail"`
2022-12-16 20:29:45 +08:00
Alipay Alipay `mapstructure:"alipay"`
2022-11-28 16:38:30 +08:00
}
2022-12-17 20:41:08 +08:00
// 服务端启动配置
2022-11-28 16:38:30 +08:00
type Server struct {
2022-12-17 20:41:08 +08:00
Port int `mapstructure:"port"`
Runenv string `mapstructure:"runenv"`
2022-11-28 16:38:30 +08:00
}
// MySQL数据库配置
type Mysql struct {
Host string `mapstructure:"host"`
Port int `mapstructure:"port"`
Username string `mapstructure:"username"`
Password string `mapstructure:"password"`
Dbname string `mapstructure:"dbname"`
MaxIdleConns int `mapstructure:"maxIdleConns"`
MaxOpenConns int `mapstructure:"maxOpenConns"`
ConnMaxLifetime int `mapstructure:"connMaxLifetime"`
2023-01-28 21:13:32 +08:00
DbFile string `mapstructure:"dbFile"`
2022-11-28 16:38:30 +08:00
}
// Redis数据库配置
type Redis struct {
Host string `mapstructure:"host"`
Port int `mapstructure:"port"`
Password string `mapstructure:"password"`
Database int `mapstructure:"database"`
}
// JWT用户认证配置
type Jwt struct {
2022-12-11 20:02:19 +08:00
SigningKey string `mapstructure:"signingKey"`
ExpiredTime int `mapstructure:"expiredTime"`
2022-11-28 16:38:30 +08:00
}
2022-12-27 19:22:38 +08:00
// 文件存储配置
type File struct {
Path string `mapstructure:"path"`
}
2022-11-28 16:38:30 +08:00
// 邮件服务配置
type Mail struct {
Smtp string `mapstructure:"smtp"`
Secret string `mapstructure:"secret"`
Sender string `mapstructure:"sender"`
}
2022-12-16 20:29:45 +08:00
// 支付宝支付服务配置
type Alipay struct {
AppId string `mapstructure:"appId"`
PrivateKey string `mapstructure:"privateKey"`
AppPublicCert string `mapstructure:"appPublicCert"`
AlipayRootCert string `mapstructure:"alipayRootCert"`
AlipayPublicCert string `mapstructure:"alipayPublicCert"`
ReturnURL string `mapstructure:"returnURL"`
NotifyURL string `mapstructure:"notifyURL"`
}