implemented NATS event bus, websocket hub upgrade, and audit log

This commit is contained in:
2026-05-11 19:38:02 +02:00
parent db0f402ab2
commit 83d96d0a1e
16 changed files with 502 additions and 15 deletions
+8 -1
View File
@@ -18,6 +18,7 @@ import (
"github.com/forgeo/forgebucket/internal/config"
"github.com/forgeo/forgebucket/internal/db"
gitdomain "github.com/forgeo/forgebucket/internal/domain/git"
"github.com/forgeo/forgebucket/internal/events"
"github.com/forgeo/forgebucket/internal/models/migrations"
"github.com/forgeo/forgebucket/web"
)
@@ -42,6 +43,12 @@ func main() {
gitdomain.SetRepoRoot(cfg.RepoRoot)
bus, err := events.New(cfg.NATSUrl)
if err != nil {
log.Fatalf("events: %v", err)
}
defer bus.Close()
store := sessions.NewCookieStore([]byte(cfg.SessionSecret))
store.Options = &sessions.Options{
Path: "/",
@@ -51,7 +58,7 @@ func main() {
SameSite: http.SameSiteLaxMode,
}
handler := api.New(cfg, engine, store, web.FS())
handler := api.New(cfg, engine, store, bus, web.FS())
srv := &http.Server{
Addr: fmt.Sprintf(":%s", cfg.Port),