about summary refs log tree commit diff stats
path: root/cmd/server/main.go
diff options
context:
space:
mode:
authorAlan Pearce2024-12-12 11:09:47 +0100
committerAlan Pearce2024-12-12 18:16:10 +0100
commitfed650743913797a314d8fc7d7550ba21dce0a12 (patch)
treec2d5e62fafbf9cee7f862927a5894da807f5d34b /cmd/server/main.go
parentb66c1ed87b556844421886ead373ffdd4ca25663 (diff)
downloadwebsite-nats.tar.lz
website-nats.tar.zst
website-nats.zip
setup embedded NATS cluster nats
Diffstat (limited to 'cmd/server/main.go')
-rw-r--r--cmd/server/main.go9
1 files changed, 9 insertions, 0 deletions
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")
 }