From 24bca7067b02844dc275ed6e22f96f20ab02f82e Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Thu, 2 Jan 2025 19:43:53 +0100 Subject: feat(tfstated): bootstrap webui listening on a second port --- cmd/tfstated/main.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'cmd') diff --git a/cmd/tfstated/main.go b/cmd/tfstated/main.go index 8b462f7..a1c74ca 100644 --- a/cmd/tfstated/main.go +++ b/cmd/tfstated/main.go @@ -26,7 +26,8 @@ func run( return err } - backend := backend.Run(ctx, db, getenv, stderr) + backend := backend.Run(ctx, db, getenv) + webui := webui.Run(ctx, db, getenv) <-ctx.Done() shutdownCtx := context.Background() @@ -34,13 +35,17 @@ func run( defer shutdownCancel() var wg sync.WaitGroup - wg.Add(1) + wg.Add(2) go func() { defer wg.Done() if err := backend.Shutdown(shutdownCtx); err != nil { slog.Error("error shutting down backend http server", "error", err) } }() + go func() { + defer wg.Done() + if err := webui.Shutdown(shutdownCtx); err != nil { + slog.Error("error shutting down webui http server", "error", err) } }() wg.Wait() -- cgit v1.2.3