From fed650743913797a314d8fc7d7550ba21dce0a12 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 12 Dec 2024 11:09:47 +0100 Subject: setup embedded NATS cluster --- cmd/server/main.go | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'cmd/server/main.go') diff --git a/cmd/server/main.go b/cmd/server/main.go index 652ffa3..01b8c54 100644 --- a/cmd/server/main.go +++ b/cmd/server/main.go @@ -6,6 +6,7 @@ import ( "os" "os/signal" + "go.alanpearce.eu/website/internal/nats" "go.alanpearce.eu/website/internal/server" "go.alanpearce.eu/x/log" @@ -52,8 +53,16 @@ func main() { } }() + go func() { + err := nats.Start(log.Named("nats")) + if err != nil { + log.Warn("could not start NATS server", "error", err) + } + }() + <-ctx.Done() log.Debug("calling stop") <-sv.Stop() + nats.Stop() log.Debug("done") } -- cgit 1.4.1