You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
668 B
41 lines
668 B
package config
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/zeromicro/go-zero/zrpc"
|
|
)
|
|
|
|
// MySQL 数据库配置
|
|
type MySQLConf struct {
|
|
Host string
|
|
Port int
|
|
User string
|
|
Password string
|
|
DBName string
|
|
MaxIdleConns int
|
|
MaxOpenConns int
|
|
}
|
|
|
|
func (m MySQLConf) DSN() string {
|
|
return fmt.Sprintf("%s:%s@tcp(%s:%d)/%s?charset=utf8mb4&parseTime=True&loc=Local",
|
|
m.User, m.Password, m.Host, m.Port, m.DBName)
|
|
}
|
|
|
|
type RedisGoConf struct {
|
|
Host string
|
|
Port int
|
|
Pass string
|
|
DB int
|
|
}
|
|
|
|
type Config struct {
|
|
zrpc.RpcServerConf
|
|
MySQL MySQLConf
|
|
RedisGo RedisGoConf
|
|
AuthRpc struct {
|
|
AccessSecret string
|
|
AccessExpire int64
|
|
}
|
|
TkStore bool
|
|
}
|
|
|