Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion internal/utils/connect.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions internal/utils/profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
}
Expand All @@ -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",
Expand All @@ -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
Expand Down
Loading