Skip to content

Commit d6a1803

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

2 files changed

Lines changed: 4 additions & 6 deletions

File tree

pkg/config/api.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ type (
1919
KongImage string `toml:"-"`
2020
Port uint16 `toml:"port"`
2121
Tls tlsKong `toml:"tls"`
22-
// TODO: replace [auth|studio].api_url
23-
ExternalUrl string `toml:"external_url"`
2422
}
2523

2624
tlsKong struct {

pkg/config/config.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,7 @@ func (c *config) Load(path string, fsys fs.FS, overrides ...ConfigEditor) error
600600
if connString, err := fs.ReadFile(fsys, builder.PoolerUrlPath); err == nil && len(connString) > 0 {
601601
c.Db.Pooler.ConnectionString = string(connString)
602602
}
603-
if len(c.Api.ExternalUrl) == 0 {
603+
if len(c.Studio.ApiUrl) == 0 {
604604
// Update external api url
605605
apiUrl := url.URL{Host: net.JoinHostPort(c.Hostname,
606606
strconv.FormatUint(uint64(c.Api.Port), 10),
@@ -610,11 +610,11 @@ func (c *config) Load(path string, fsys fs.FS, overrides ...ConfigEditor) error
610610
} else {
611611
apiUrl.Scheme = "http"
612612
}
613-
c.Api.ExternalUrl = apiUrl.String()
613+
c.Studio.ApiUrl = apiUrl.String()
614614
}
615615
// Set default JWT issuer if not configured
616616
if len(c.Auth.JwtIssuer) == 0 {
617-
c.Auth.JwtIssuer = c.Api.ExternalUrl + "/auth/v1"
617+
c.Auth.JwtIssuer = c.Studio.ApiUrl + "/auth/v1"
618618
}
619619
// Update image versions
620620
switch c.Db.MajorVersion {
@@ -860,7 +860,7 @@ func (c *config) Validate(fsys fs.FS) error {
860860
if parsed, err := url.Parse(c.Studio.ApiUrl); err != nil {
861861
return errors.Errorf("Invalid config for studio.api_url: %w", err)
862862
} else if parsed.Host == "" || parsed.Host == c.Hostname {
863-
c.Studio.ApiUrl = c.Api.ExternalUrl
863+
return errors.New("studio.api_url must be set to a different host than the project hostname")
864864
}
865865
}
866866
// Validate smtp config

0 commit comments

Comments
 (0)