update initial settings with minimum log level and use new SetRandomPassword method

This commit is contained in:
Henry Dollman
2025-01-05 17:56:42 -05:00
parent 5fd9010b39
commit fc31cefd4c

View File

@@ -3,7 +3,6 @@ package migrations
import ( import (
"github.com/pocketbase/pocketbase/core" "github.com/pocketbase/pocketbase/core"
m "github.com/pocketbase/pocketbase/migrations" m "github.com/pocketbase/pocketbase/migrations"
"github.com/pocketbase/pocketbase/tools/security"
) )
var ( var (
@@ -16,6 +15,7 @@ func init() {
settings := app.Settings() settings := app.Settings()
settings.Meta.AppName = "Beszel" settings.Meta.AppName = "Beszel"
settings.Meta.HideControls = true settings.Meta.HideControls = true
settings.Logs.MinLevel = 4
if err := app.Save(settings); err != nil { if err := app.Save(settings); err != nil {
return err return err
} }
@@ -23,7 +23,7 @@ func init() {
collection, _ := app.FindCollectionByNameOrId(core.CollectionNameSuperusers) collection, _ := app.FindCollectionByNameOrId(core.CollectionNameSuperusers)
user := core.NewRecord(collection) user := core.NewRecord(collection)
user.SetEmail(TempAdminEmail) user.SetEmail(TempAdminEmail)
user.SetPassword(security.RandomString(12)) user.SetRandomPassword()
return app.Save(user) return app.Save(user)
}, nil) }, nil)
} }