mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-11 20:37:30 -06:00
Generate VAPID key pair during startup
This commit is contained in:
parent
7a02a19c3c
commit
821c1da688
4 changed files with 59 additions and 25 deletions
|
|
@ -19,7 +19,7 @@ package testrig
|
|||
|
||||
import (
|
||||
"context"
|
||||
|
||||
webpushgo "github.com/SherClockHolmes/webpush-go"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/db"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/db/bundb"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
|
||||
|
|
@ -368,6 +368,15 @@ func StandardDBSetup(db db.DB, accounts map[string]*gtsmodel.Account) {
|
|||
log.Panic(ctx, err)
|
||||
}
|
||||
|
||||
vapidKeyPair := >smodel.VAPIDKeyPair{}
|
||||
var err error
|
||||
if vapidKeyPair.Private, vapidKeyPair.Public, err = webpushgo.GenerateVAPIDKeys(); err != nil {
|
||||
log.Panic(nil, err)
|
||||
}
|
||||
if err = db.PutVAPIDKeyPair(ctx, vapidKeyPair); err != nil {
|
||||
log.Panic(nil, err)
|
||||
}
|
||||
|
||||
log.Debug(ctx, "testing db setup complete")
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue