package test

import (
	"go-admin/common/helper"
	"go-admin/config"

	"github.com/go-admin-team/go-admin-core/sdk"
	"gorm.io/driver/mysql"
	"gorm.io/gorm"
)

func InitSettings() *gorm.DB {
	dsn := "root:123456@tcp(127.0.0.1:3306)/go_exchange_single?charset=utf8mb4&parseTime=True&loc=Local&timeout=1000ms"
	db, _ := gorm.Open(mysql.Open(dsn), &gorm.Config{})
	sdk.Runtime.SetDb("default", db)
	helper.InitDefaultRedis("127.0.0.1:6379", "", 2)
	helper.InitLockRedisConn("127.0.0.1:6379", "", "2")

	config.ExtConfig.ProxyUrl = "http://127.0.0.1:7890"

	return db
}
