36 lines
597 B
Go
36 lines
597 B
Go
package model
|
|
|
|
import (
|
|
"github.com/loveuer/nf-disk/internal/opt"
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
func Init(tx *gorm.DB) (err error) {
|
|
if err = tx.AutoMigrate(
|
|
&Connection{},
|
|
); err != nil {
|
|
return err
|
|
}
|
|
|
|
if opt.Debug {
|
|
if err = tx.Create([]*Connection{
|
|
{
|
|
Name: "dev-minio",
|
|
Endpoint: "http://10.220.10.15:9000",
|
|
Access: "8ALV3DUZI31YG4BDRJ0Z",
|
|
Key: "CRqwS1MsiUj27TbRK+3T2n+LpKWd07VvaDKuzU0H",
|
|
},
|
|
{
|
|
Name: "test",
|
|
Endpoint: "http://10.220.10.14:19000",
|
|
Access: "",
|
|
Key: "",
|
|
},
|
|
}).Error; err != nil {
|
|
return err
|
|
}
|
|
}
|
|
|
|
return
|
|
}
|