bootstrap

This commit is contained in:
微凉
2021-10-27 22:45:36 +08:00
parent 9644cc98c3
commit 55f683b12d
18 changed files with 311 additions and 133 deletions

View File

@ -2,7 +2,6 @@ package model
import (
"github.com/Xhofe/alist/conf"
log "github.com/sirupsen/logrus"
)
type Account struct {
@ -22,6 +21,7 @@ type Account struct {
var accountsMap = map[string]Account{}
// SaveAccount save account to database
func SaveAccount(account Account) error {
if err := conf.DB.Save(account).Error; err != nil {
return err
@ -80,14 +80,3 @@ func GetAccounts() []*Account {
return accounts
}
func initAccounts() {
log.Infof("init accounts...")
var accounts []Account
if err := conf.DB.Find(&accounts).Error; err != nil {
log.Fatalf("failed sync init accounts")
}
for _, account := range accounts {
RegisterAccount(account)
}
log.Debugf("accounts:%+v", accountsMap)
}