Skip to content

Commit 7852108

Browse files
committed
fix(config): replace external-url into studio api
1 parent 1d5b8ed commit 7852108

5 files changed

Lines changed: 8 additions & 17 deletions

File tree

internal/start/start.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1162,7 +1162,7 @@ EOF
11621162
"STUDIO_PG_META_URL=http://" + utils.PgmetaId + ":8080",
11631163
"POSTGRES_PASSWORD=" + dbConfig.Password,
11641164
"SUPABASE_URL=http://" + utils.KongId + ":8000",
1165-
"SUPABASE_PUBLIC_URL=" + utils.Config.Studio.ApiUrl,
1165+
"SUPABASE_PUBLIC_URL=" + utils.Config.Api.ExternalUrl,
11661166
"AUTH_JWT_SECRET=" + utils.Config.Auth.JwtSecret.Value,
11671167
"SUPABASE_ANON_KEY=" + utils.Config.Auth.AnonKey.Value,
11681168
"SUPABASE_SERVICE_KEY=" + utils.Config.Auth.ServiceRoleKey.Value,

pkg/config/api.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,11 @@ type (
1515
ExtraSearchPath []string `toml:"extra_search_path" json:"extra_search_path"`
1616
MaxRows uint `toml:"max_rows" json:"max_rows"`
1717
// Local only config
18-
Image string `toml:"-" json:"-"`
19-
KongImage string `toml:"-" json:"-"`
20-
Port uint16 `toml:"port" json:"port"`
21-
Tls tlsKong `toml:"tls" json:"tls"`
22-
// TODO: replace [auth|studio].api_url
23-
ExternalUrl string `toml:"external_url" json:"external_url"`
18+
Image string `toml:"-"`
19+
KongImage string `toml:"-"`
20+
Port uint16 `toml:"port"`
21+
Tls tlsKong `toml:"tls"`
22+
ExternalUrl string `toml:"external_url"`
2423
}
2524

2625
tlsKong struct {

pkg/config/config.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,6 @@ type (
172172
Enabled bool `toml:"enabled" json:"enabled"`
173173
Image string `toml:"-" json:"-"`
174174
Port uint16 `toml:"port" json:"port"`
175-
ApiUrl string `toml:"api_url" json:"api_url"`
176175
OpenaiApiKey Secret `toml:"openai_api_key" json:"openai_api_key"`
177176
PgmetaImage string `toml:"-" json:"-"`
178177
}
@@ -857,11 +856,6 @@ func (c *config) Validate(fsys fs.FS) error {
857856
if c.Studio.Port == 0 {
858857
return errors.New("Missing required field in config: studio.port")
859858
}
860-
if parsed, err := url.Parse(c.Studio.ApiUrl); err != nil {
861-
return errors.Errorf("Invalid config for studio.api_url: %w", err)
862-
} else if parsed.Host == "" || parsed.Host == c.Hostname {
863-
c.Studio.ApiUrl = c.Api.ExternalUrl
864-
}
865859
}
866860
// Validate smtp config
867861
if c.Inbucket.Enabled {

pkg/config/templates/config.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ extra_search_path = ["public", "extensions"]
1616
# The maximum number of rows returns from a view, table, or stored procedure. Limits payload size
1717
# for accidental or malicious requests.
1818
max_rows = 1000
19+
# External URL of the API server that frontend connects to. Defaults to http(s)://hostname:api.port when empty.
20+
# external_url = ""
1921

2022
[api.tls]
2123
# Enable HTTPS endpoints locally using a self-signed certificate.
@@ -89,8 +91,6 @@ enabled = true
8991
enabled = true
9092
# Port to use for Supabase Studio.
9193
port = 54323
92-
# External URL of the API server that frontend connects to.
93-
api_url = "http://127.0.0.1"
9494
# OpenAI API Key to use for Supabase AI in the Supabase Studio.
9595
openai_api_key = "env(OPENAI_API_KEY)"
9696

pkg/config/testdata/config.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,6 @@ max_header_length = 8192
8989
enabled = true
9090
# Port to use for Supabase Studio.
9191
port = 54323
92-
# External URL of the API server that frontend connects to.
93-
api_url = "http://127.0.0.1"
9492
# OpenAI API Key to use for Supabase AI in the Supabase Studio.
9593
openai_api_key = "env(OPENAI_API_KEY)"
9694

0 commit comments

Comments
 (0)