mirror of
https://github.com/henrygd/beszel.git
synced 2025-12-17 10:46:16 +01:00
refactor: alerts / emails
This commit is contained in:
@@ -46,9 +46,8 @@ func NewHub(app *pocketbase.PocketBase) *Hub {
|
||||
}
|
||||
|
||||
func (h *Hub) Run() {
|
||||
|
||||
rm := records.NewRecordManager(h.app)
|
||||
am := alerts.NewAlertManager(h.app)
|
||||
var rm *records.RecordManager
|
||||
var am *alerts.AlertManager
|
||||
|
||||
// loosely check if it was executed using "go run"
|
||||
isGoRun := strings.HasPrefix(os.Args[0], os.TempDir())
|
||||
@@ -60,6 +59,13 @@ func (h *Hub) Run() {
|
||||
Dir: "../../migrations",
|
||||
})
|
||||
|
||||
// set up record manager and alert manager
|
||||
h.app.OnBeforeServe().Add(func(e *core.ServeEvent) error {
|
||||
rm = records.NewRecordManager(h.app)
|
||||
am = alerts.NewAlertManager(h.app)
|
||||
return nil
|
||||
})
|
||||
|
||||
// set auth settings
|
||||
h.app.OnBeforeServe().Add(func(e *core.ServeEvent) error {
|
||||
usersCollection, err := h.app.Dao().FindCollectionByNameOrId("users")
|
||||
|
||||
Reference in New Issue
Block a user