1Panel/backend/init/db/db.go

17 lines
262 B
Go
Raw Normal View History

2022-08-16 23:30:23 +08:00
package db
2022-11-16 18:27:22 +08:00
import (
"github.com/1Panel-dev/1Panel/backend/global"
"gorm.io/driver/sqlite"
"gorm.io/gorm"
)
2022-08-16 23:30:23 +08:00
func Init() {
2022-11-16 18:27:22 +08:00
s := global.CONF.Sqlite
db, err := gorm.Open(sqlite.Open(s.Dsn()), &gorm.Config{})
if err != nil {
panic(err)
2022-08-16 23:30:23 +08:00
}
2022-11-16 18:27:22 +08:00
global.DB = db
2022-08-16 23:30:23 +08:00
}