diff --git a/magefiles/magefile.go b/magefiles/magefile.go index 6674d2f2..12812305 100644 --- a/magefiles/magefile.go +++ b/magefiles/magefile.go @@ -21,7 +21,7 @@ const containerImage string = "topaz" func init() { os.Setenv("GO_VERSION", "1.20") os.Setenv("DOCKER_BUILDKIT", "1") - os.Setenv("CONSOLE_VERSION", "0.8.66-20231002144058.64.g51d1cc0c.v3") + os.Setenv("CONSOLE_VERSION", "0.0.0-20231002232018.0.gef5db259") } // Generate generates all code. diff --git a/pkg/app/ui/handler.go b/pkg/app/ui/handler.go index b74de084..2a6099ce 100644 --- a/pkg/app/ui/handler.go +++ b/pkg/app/ui/handler.go @@ -68,19 +68,19 @@ func ConfigHandler(confServices *config.Config) func(w http.ResponseWriter, r *h func composeConfig(confServices *config.Config, apiKey string) *consoleCfg { cfg := &consoleCfg{} - cfg.AsertoDirectoryReaderURL = fmt.Sprintf("https://%s", confServices.Services["reader"].Gateway.ListenAddress) - cfg.AsertoDirectoryURL = fmt.Sprintf("https://%s", confServices.Services["reader"].Gateway.ListenAddress) + cfg.AsertoDirectoryReaderURL = fmt.Sprintf("https://%s", serviceAddress(confServices.Services["reader"].Gateway.ListenAddress)) + cfg.AsertoDirectoryURL = fmt.Sprintf("https://%s", serviceAddress(confServices.Services["reader"].Gateway.ListenAddress)) if confServices.Services["writer"] != nil { - cfg.AsertoDirectoryWriterURL = fmt.Sprintf("https://%s", confServices.Services["writer"].Gateway.ListenAddress) + cfg.AsertoDirectoryWriterURL = fmt.Sprintf("https://%s", serviceAddress(confServices.Services["writer"].Gateway.ListenAddress)) } if confServices.Services["model"] != nil { - cfg.AsertoDirectoryModelURL = fmt.Sprintf("https://%s", confServices.Services["model"].Gateway.ListenAddress) + cfg.AsertoDirectoryModelURL = fmt.Sprintf("https://%s", serviceAddress(confServices.Services["model"].Gateway.ListenAddress)) } if serviceConfig, ok := confServices.Services["authorizer"]; ok { - cfg.AuthorizerServiceURL = fmt.Sprintf("https://%s", serviceConfig.Gateway.ListenAddress) + cfg.AuthorizerServiceURL = fmt.Sprintf("https://%s", serviceAddress(serviceConfig.Gateway.ListenAddress)) cfg.AuthorizerAPIKey = apiKey } @@ -91,6 +91,21 @@ func composeConfig(confServices *config.Config, apiKey string) *consoleCfg { return cfg } +func serviceAddress(listenAddress string) string { + addr, port, found := strings.Cut(listenAddress, ":") + if addr == "0.0.0.0" { + addr = "localhost" + } + + fmt.Println("addr: ", addr) + + if found { + return fmt.Sprintf("%s:%s", addr, port) + } + + return addr +} + func composeRemoteDiretoryConfig(confServices *config.Config, apiKey string) *consoleCfgWithRemoteDirectory { cfg := &consoleCfgWithRemoteDirectory{} host := strings.Split(confServices.DirectoryResolver.Address, ":")[0]