diff --git a/internal/utils/connect.go b/internal/utils/connect.go index 3223bb032..bd8d199f7 100644 --- a/internal/utils/connect.go +++ b/internal/utils/connect.go @@ -98,7 +98,7 @@ func assertDomainInProfile(host string) error { if err != nil { return errors.Errorf("failed to parse pooler TLD: %w", err) } - if !strings.HasSuffix(CurrentProfile.APIURL, "."+domain) { + if len(CurrentProfile.PoolerHost) > 0 && !strings.EqualFold(CurrentProfile.PoolerHost, domain) { return errors.Errorf("Pooler domain does not belong to current profile: %s", domain) } return nil diff --git a/internal/utils/profile.go b/internal/utils/profile.go index 06b607a0d..eef9e5a0d 100644 --- a/internal/utils/profile.go +++ b/internal/utils/profile.go @@ -16,6 +16,7 @@ type Profile struct { APIURL string `mapstructure:"api_url" validate:"required,http_url"` DashboardURL string `mapstructure:"dashboard_url" validate:"required,http_url"` ProjectHost string `mapstructure:"project_host" validate:"required,hostname_rfc1123"` + PoolerHost string `mapstructure:"pooler_host" validate:"omitempty,hostname_rfc1123"` DocsURL string `mapstructure:"docs_url" validate:"omitempty,http_url"` StudioImage string `mapstructure:"studio_image"` } @@ -26,12 +27,14 @@ var allProfiles = []Profile{{ DashboardURL: "https://supabase.com/dashboard", DocsURL: "https://supabase.com/docs", ProjectHost: "supabase.co", + PoolerHost: "supabase.com", }, { Name: "supabase-staging", APIURL: "https://api.supabase.green", DashboardURL: "https://supabase.green/dashboard", DocsURL: "https://supabase.com/docs", ProjectHost: "supabase.red", + PoolerHost: "supabase.green", }, { Name: "supabase-local", APIURL: "http://localhost:8080", @@ -44,6 +47,7 @@ var allProfiles = []Profile{{ DashboardURL: "https://cloud.snap.com/dashboard", DocsURL: "https://cloud.snap.com/docs", ProjectHost: "snapcloud.dev", + PoolerHost: "snapcloud.co", }} var CurrentProfile Profile