MCPcopy
hub / github.com/PatchMon/PatchMon / constructServerURL

Function constructServerURL

server-source-code/internal/handler/settings.go:777–783  ·  view source on GitHub ↗

constructServerURL builds a server URL from protocol, host, and port. Omits port for default ports (80 for http, 443 for https).

(protocol, host string, port int)

Source from the content-addressed store, hash-verified

775// constructServerURL builds a server URL from protocol, host, and port.
776// Omits port for default ports (80 for http, 443 for https).
777func constructServerURL(protocol, host string, port int) string {
778 proto := strings.ToLower(protocol)
779 if (proto == "https" && port == 443) || (proto == "http" && port == 80) {
780 return proto + "://" + host
781 }
782 return proto + "://" + host + ":" + strconv.Itoa(port)
783}
784
785func applySettingsUpdate(s *models.Settings, req map[string]interface{}, enc *util.Encryption) {
786 urlVal, hasExplicitURL := getReqString(req, "server_url", "serverUrl")

Callers 1

applySettingsUpdateFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected