testing simplyfied urlFormat() method which works thanks to traefik

This commit is contained in:
pb 2025-03-13 16:57:27 +01:00
parent 1ae38c98ad
commit 88c88cac5b

View File

@ -4,7 +4,6 @@ import (
"encoding/json" "encoding/json"
"errors" "errors"
"fmt" "fmt"
"regexp"
"strings" "strings"
"cloud.o-forge.io/core/oc-lib/tools" "cloud.o-forge.io/core/oc-lib/tools"
@ -32,7 +31,7 @@ type PeerCache struct {
func (p *PeerCache) urlFormat(hostUrl string, dt tools.DataType) string { func (p *PeerCache) urlFormat(hostUrl string, dt tools.DataType) string {
// localhost is replaced by the local peer URL // localhost is replaced by the local peer URL
// because localhost must collide on a web request security protocol // because localhost must collide on a web request security protocol
localhost := "" /*localhost := ""
if strings.Contains(hostUrl, "localhost") { if strings.Contains(hostUrl, "localhost") {
localhost = "localhost" localhost = "localhost"
} }
@ -47,9 +46,9 @@ func (p *PeerCache) urlFormat(hostUrl string, dt tools.DataType) string {
} else { } else {
hostUrl = strings.ReplaceAll(hostUrl, localhost, dt.API()+":8080/oc") hostUrl = strings.ReplaceAll(hostUrl, localhost, dt.API()+":8080/oc")
} }
} else { } else {*/
hostUrl = hostUrl + "/" + strings.ReplaceAll(dt.API(), "oc-", "") hostUrl = hostUrl + "/" + strings.ReplaceAll(dt.API(), "oc-", "")
} //}
fmt.Println("Contacting", hostUrl) fmt.Println("Contacting", hostUrl)
return hostUrl return hostUrl
} }