From a360e0c7b122b963544ae9b416c50b4e9cc16055 Mon Sep 17 00:00:00 2001 From: Wes Date: Mon, 6 Nov 2023 08:14:39 -0700 Subject: [PATCH] fix: db port when `ftl serve` creates from scratch (#558) Fixes #557 We weren't setting the port correctly after a new db had been created. --- cmd/ftl/cmd_serve.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/ftl/cmd_serve.go b/cmd/ftl/cmd_serve.go index 4ee89156a0..b103d50e1b 100644 --- a/cmd/ftl/cmd_serve.go +++ b/cmd/ftl/cmd_serve.go @@ -96,7 +96,7 @@ func (s *serveCmd) setupDB(ctx context.Context) (string, error) { } recreate := s.Recreate - port := "" + port := fmt.Sprintf("%d", s.DBPort) if len(output) == 0 { logger.Infof("Creating docker container '%s' for postgres db", ftlContainerName) @@ -113,7 +113,7 @@ func (s *serveCmd) setupDB(ctx context.Context) (string, error) { "--user", "postgres", "--restart", "always", "-e", "POSTGRES_PASSWORD=secret", - "-p", fmt.Sprintf("%d:5432", s.DBPort), + "-p", fmt.Sprintf("%s:5432", port), "--health-cmd=pg_isready", "--health-interval=1s", "--health-timeout=60s",