From 4b0f3a59e1cd1090026b07bfd977adef6376375c Mon Sep 17 00:00:00 2001 From: Wes Date: Tue, 5 Mar 2024 19:33:39 -0800 Subject: [PATCH] fix: update url output for the console (#1023) I think a recent update to the buf connect stuff might have surfaced an issue with using `http://localhost:5173` for the console. --- backend/controller/controller.go | 2 +- frontend/local.go | 8 ++++---- frontend/release.go | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/backend/controller/controller.go b/backend/controller/controller.go index 9f07e9b1c9..82a0a4ae3e 100644 --- a/backend/controller/controller.go +++ b/backend/controller/controller.go @@ -86,7 +86,7 @@ func Start(ctx context.Context, config Config, runnerScaling scaling.RunnerScali _, _ = w.Write([]byte("Console not installed.")) }) } else { - consoleHandler, err = frontend.Server(ctx, config.ContentTime, config.ConsoleURL) + consoleHandler, err = frontend.Server(ctx, config.ContentTime, config.Bind, config.ConsoleURL) if err != nil { return err } diff --git a/frontend/local.go b/frontend/local.go index f96c6b0919..fb63b7d3c3 100644 --- a/frontend/local.go +++ b/frontend/local.go @@ -14,10 +14,10 @@ import ( "github.com/TBD54566975/ftl/internal/log" ) -var consoleURL, _ = url.Parse("http://localhost:5173") -var proxy = httputil.NewSingleHostReverseProxy(consoleURL) +var proxyURL, _ = url.Parse("http://localhost:5173") +var proxy = httputil.NewSingleHostReverseProxy(proxyURL) -func Server(ctx context.Context, timestamp time.Time, allowOrigin *url.URL) (http.Handler, error) { +func Server(ctx context.Context, timestamp time.Time, publicURL *url.URL, allowOrigin *url.URL) (http.Handler, error) { logger := log.FromContext(ctx) logger.Debugf("Building console...") @@ -30,7 +30,7 @@ func Server(ctx context.Context, timestamp time.Time, allowOrigin *url.URL) (htt if err != nil { return nil, err } - logger.Infof("Web console available at: %s", consoleURL) + logger.Infof("Web console available at: %s", publicURL.String()) if allowOrigin == nil { return proxy, nil diff --git a/frontend/release.go b/frontend/release.go index 5b9d1575f8..d9115df8f8 100644 --- a/frontend/release.go +++ b/frontend/release.go @@ -22,7 +22,7 @@ import ( //go:embed all:dist var build embed.FS -func Server(ctx context.Context, timestamp time.Time, allowOrigin *url.URL) (http.Handler, error) { +func Server(ctx context.Context, timestamp time.Time, publicURL *url.URL, allowOrigin *url.URL) (http.Handler, error) { dir, err := fs.Sub(build, "dist") if err != nil { return nil, err