feat: add jwt

This commit is contained in:
fallen-angle
2022-02-10 17:08:42 +08:00
parent 77f7d0caad
commit 2d43931fc8
10 changed files with 165 additions and 5 deletions

View File

@@ -6,12 +6,13 @@ import (
"gorm.io/driver/mysql"
"gorm.io/gorm"
"gorm.io/gorm/schema"
)
func initMySQL() {
mysqlConf := global.ServerSettings.MySQL
dsn := fmt.Sprintf("%s:%s@tcp(%s:%d)/%s?charset=utf8mb4&parseTime=True&loc=Local", mysqlConf.Username, mysqlConf.Password, mysqlConf.Host, mysqlConf.Port, mysqlConf.Database)
db, err := gorm.Open(mysql.Open(dsn), &gorm.Config{})
db, err := gorm.Open(mysql.Open(dsn), &gorm.Config{NamingStrategy: schema.NamingStrategy{SingularTable: true}})
if err != nil {
panic(err)
}