MCPcopy Index your code
hub / github.com/coder/coder / ChangePortProtocol

Method ChangePortProtocol

coderd/workspaceapps/appurl/appurl.go:124–144  ·  view source on GitHub ↗
(target string)

Source from the content-addressed store, hash-verified

122}
123
124func (a *ApplicationURL) ChangePortProtocol(target string) ApplicationURL {
125 newAppURL := *a
126 port, protocol, isPort := a.PortInfo()
127 if !isPort {
128 return newAppURL
129 }
130
131 if target == protocol {
132 return newAppURL
133 }
134
135 if target == "https" {
136 newAppURL.AppSlugOrPort = fmt.Sprintf("%ds", port)
137 }
138
139 if target == "http" {
140 newAppURL.AppSlugOrPort = fmt.Sprintf("%d", port)
141 }
142
143 return newAppURL
144}
145
146// ParseSubdomainAppURL parses an ApplicationURL from the given subdomain. If
147// the subdomain is not a valid application URL hostname, returns a non-nil

Callers 1

ReverseProxyMethod · 0.80

Calls 1

PortInfoMethod · 0.95

Tested by

no test coverage detected