From b5326e4b787c9fce6419d69cf6805276b2a23cfe Mon Sep 17 00:00:00 2001 From: William Batista Date: Wed, 28 Aug 2024 18:04:45 -0400 Subject: [PATCH] use the closest region to the user, if it's not set --- internal/build/imgsrc/depot.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/internal/build/imgsrc/depot.go b/internal/build/imgsrc/depot.go index 0ad2248a06..a91201c203 100644 --- a/internal/build/imgsrc/depot.go +++ b/internal/build/imgsrc/depot.go @@ -181,6 +181,13 @@ func initBuilder(ctx context.Context, buildState *build, appName string, streams region = regionEnv } + if region == "" { + closestRegion, err := apiClient.GetNearestRegion(ctx) + if err == nil { + region = closestRegion.Code + } + } + if region != "" { region = "fly-" + region }