Federation Refactoring & Architecture Improvements (#930)
* initial commit * add lists * update permissions * fix waypoint create * needs_full_sync for activitypub trails * fixes build issues * fix list get * further CSRF protection * update API docs * adds rate limiter * fix tiptap mentions * a bit more cleanup of main.go * Fix migration order * fixes reviewed notes * require context for activitpub server calls * improve hashing for identifier * fix copy paste error * fix sync trail/list issues * fix summit log/comment duplicates * adaptions after trail merge * fix dockerignore --------- Co-authored-by: Christian Beutel <> Co-authored-by: slothful-vassal <89943360+slothful-vassal@users.noreply.github.com>
This commit is contained in:
47
db/hooks/bootstrap.go
Normal file
47
db/hooks/bootstrap.go
Normal file
@@ -0,0 +1,47 @@
|
||||
package hooks
|
||||
|
||||
import (
|
||||
"cmp"
|
||||
"os"
|
||||
|
||||
"github.com/pocketbase/pocketbase/core"
|
||||
"github.com/spf13/cast"
|
||||
)
|
||||
|
||||
func OnBootstrapHandler() func(se *core.BootstrapEvent) error {
|
||||
return func(e *core.BootstrapEvent) error {
|
||||
if err := e.Next(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if e.App.Settings().Meta.AppName == "Acme" {
|
||||
e.App.Settings().Meta.AppName = "wanderer"
|
||||
}
|
||||
if v := os.Getenv("ORIGIN"); v != "" {
|
||||
e.App.Settings().Meta.AppURL = v
|
||||
}
|
||||
if v := cmp.Or(os.Getenv("POCKETBASE_SMTP_SENDER_ADDRESS"), os.Getenv("POCKETBASE_SMTP_SENDER_ADRESS")); v != "" {
|
||||
e.App.Settings().Meta.SenderAddress = v
|
||||
}
|
||||
if v := os.Getenv("POCKETBASE_SMTP_SENDER_NAME"); v != "" {
|
||||
e.App.Settings().Meta.SenderName = v
|
||||
}
|
||||
if v := os.Getenv("POCKETBASE_SMTP_ENABLED"); v != "" {
|
||||
e.App.Settings().SMTP.Enabled = cast.ToBool(v)
|
||||
}
|
||||
if v := os.Getenv("POCKETBASE_SMTP_HOST"); v != "" {
|
||||
e.App.Settings().SMTP.Host = v
|
||||
}
|
||||
if v := os.Getenv("POCKETBASE_SMTP_PORT"); v != "" {
|
||||
e.App.Settings().SMTP.Port = cast.ToInt(v)
|
||||
}
|
||||
if v := os.Getenv("POCKETBASE_SMTP_USERNAME"); v != "" {
|
||||
e.App.Settings().SMTP.Username = v
|
||||
}
|
||||
if v := os.Getenv("POCKETBASE_SMTP_PASSWORD"); v != "" {
|
||||
e.App.Settings().SMTP.Password = v
|
||||
}
|
||||
|
||||
return e.App.Save(e.App.Settings())
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user