Skip to content

Commit

Permalink
fix: update url output for the console (#1023)
Browse files Browse the repository at this point in the history
I think a recent update to the buf connect stuff might have surfaced an
issue with using `http://localhost:5173` for the console.
  • Loading branch information
wesbillman authored Mar 6, 2024
1 parent ac87ced commit 4b0f3a5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion backend/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
8 changes: 4 additions & 4 deletions frontend/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -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...")

Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion frontend/release.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4b0f3a5

Please sign in to comment.