Config UI: Add backup & restore (BC) (#22071)

Co-authored-by: Michael Geers <michael@geers.tv>
This commit is contained in:
Maschga 2025-07-14 08:19:07 +02:00 • committed by GitHub
parent 7ce12d1e08
commit ea64f76202
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
19 changed files with 1068 additions and 45 deletions

View file

@ -1,6 +1,7 @@
package session
import (
"github.com/evcc-io/evcc/server/db"
"github.com/evcc-io/evcc/util"
"gorm.io/gorm"
)
@ -12,6 +13,18 @@ type DB struct {
name string
}
var (
sessions Sessions
)
func Init() error {
err := db.Instance.AutoMigrate(new(Session))
if err == nil {
err = db.Instance.Find(&sessions).Error
}
return err
}
// NewStore creates a session store
func NewStore(name string, db *gorm.DB) (*DB, error) {
err := db.AutoMigrate(new(Session))