diff --git a/internal/start/start.go b/internal/start/start.go index 5a5cec56c6..11c19400a9 100644 --- a/internal/start/start.go +++ b/internal/start/start.go @@ -1162,7 +1162,7 @@ EOF "STUDIO_PG_META_URL=http://" + utils.PgmetaId + ":8080", "POSTGRES_PASSWORD=" + dbConfig.Password, "SUPABASE_URL=http://" + utils.KongId + ":8000", - "SUPABASE_PUBLIC_URL=" + utils.Config.Studio.ApiUrl, + "SUPABASE_PUBLIC_URL=" + utils.Config.Api.ExternalUrl, "AUTH_JWT_SECRET=" + utils.Config.Auth.JwtSecret.Value, "SUPABASE_ANON_KEY=" + utils.Config.Auth.AnonKey.Value, "SUPABASE_SERVICE_KEY=" + utils.Config.Auth.ServiceRoleKey.Value, diff --git a/pkg/config/api.go b/pkg/config/api.go index 3fd3b6f187..fdeb2b1ff5 100644 --- a/pkg/config/api.go +++ b/pkg/config/api.go @@ -15,12 +15,11 @@ type ( ExtraSearchPath []string `toml:"extra_search_path" json:"extra_search_path"` MaxRows uint `toml:"max_rows" json:"max_rows"` // Local only config - Image string `toml:"-" json:"-"` - KongImage string `toml:"-" json:"-"` - Port uint16 `toml:"port" json:"port"` - Tls tlsKong `toml:"tls" json:"tls"` - // TODO: replace [auth|studio].api_url - ExternalUrl string `toml:"external_url" json:"external_url"` + Image string `toml:"-"` + KongImage string `toml:"-"` + Port uint16 `toml:"port"` + Tls tlsKong `toml:"tls"` + ExternalUrl string `toml:"external_url"` } tlsKong struct { diff --git a/pkg/config/config.go b/pkg/config/config.go index a49e84d7df..7a9cc7198b 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -172,7 +172,6 @@ type ( Enabled bool `toml:"enabled" json:"enabled"` Image string `toml:"-" json:"-"` Port uint16 `toml:"port" json:"port"` - ApiUrl string `toml:"api_url" json:"api_url"` OpenaiApiKey Secret `toml:"openai_api_key" json:"openai_api_key"` PgmetaImage string `toml:"-" json:"-"` } @@ -857,11 +856,6 @@ func (c *config) Validate(fsys fs.FS) error { if c.Studio.Port == 0 { return errors.New("Missing required field in config: studio.port") } - if parsed, err := url.Parse(c.Studio.ApiUrl); err != nil { - return errors.Errorf("Invalid config for studio.api_url: %w", err) - } else if parsed.Host == "" || parsed.Host == c.Hostname { - c.Studio.ApiUrl = c.Api.ExternalUrl - } } // Validate smtp config if c.Inbucket.Enabled { diff --git a/pkg/config/templates/config.toml b/pkg/config/templates/config.toml index 44b58cdb0c..13b143b2f4 100644 --- a/pkg/config/templates/config.toml +++ b/pkg/config/templates/config.toml @@ -16,6 +16,8 @@ extra_search_path = ["public", "extensions"] # The maximum number of rows returns from a view, table, or stored procedure. Limits payload size # for accidental or malicious requests. max_rows = 1000 +# External URL of the API server that frontend connects to. Defaults to http(s)://hostname:api.port when empty. +# external_url = "" [api.tls] # Enable HTTPS endpoints locally using a self-signed certificate. @@ -89,8 +91,6 @@ enabled = true enabled = true # Port to use for Supabase Studio. port = 54323 -# External URL of the API server that frontend connects to. -api_url = "http://127.0.0.1" # OpenAI API Key to use for Supabase AI in the Supabase Studio. openai_api_key = "env(OPENAI_API_KEY)" diff --git a/pkg/config/testdata/config.toml b/pkg/config/testdata/config.toml index b228a9c073..0f30fa2c9b 100644 --- a/pkg/config/testdata/config.toml +++ b/pkg/config/testdata/config.toml @@ -89,8 +89,6 @@ max_header_length = 8192 enabled = true # Port to use for Supabase Studio. port = 54323 -# External URL of the API server that frontend connects to. -api_url = "http://127.0.0.1" # OpenAI API Key to use for Supabase AI in the Supabase Studio. openai_api_key = "env(OPENAI_API_KEY)"