Compare commits

..

1 Commits

Author SHA1 Message Date
2dff948e00 wip: share module
All checks were successful
arcad/edge/pipeline/head This commit looks good
2023-04-21 12:37:22 +02:00

View File

@ -73,7 +73,12 @@ func (h *Handler) serveAppURL(w http.ResponseWriter, r *http.Request) {
from := req.From
if from == "" {
from = retrieveRemoteAddr(r)
host, _, err := net.SplitHostPort(r.RemoteAddr)
if err != nil {
logger.Warn(ctx, "could not split remote address", logger.E(errors.WithStack(err)))
} else {
from = host
}
}
url, err := h.repo.GetURL(ctx, appID, from)
@ -105,12 +110,3 @@ func Mount(repository Repository) MountFunc {
r.Post("/api/v1/apps/{appID}/url", handler.serveAppURL)
}
}
func retrieveRemoteAddr(r *http.Request) string {
host, _, err := net.SplitHostPort(r.RemoteAddr)
if err != nil {
host = r.RemoteAddr
}
return host
}