SubdomainAppURL returns the URL for the given subdomain app.
(app App)
| 159 | |
| 160 | // SubdomainAppURL returns the URL for the given subdomain app. |
| 161 | func (d *Details) SubdomainAppURL(app App) *url.URL { |
| 162 | // Agent name is optional when app slug is present |
| 163 | agentName := app.AgentName |
| 164 | if !appurl.PortRegex.MatchString(app.AppSlugOrPort) { |
| 165 | agentName = "" |
| 166 | } |
| 167 | |
| 168 | appHost := appurl.ApplicationURL{ |
| 169 | Prefix: app.Prefix, |
| 170 | AppSlugOrPort: app.AppSlugOrPort, |
| 171 | AgentName: agentName, |
| 172 | WorkspaceName: app.WorkspaceName, |
| 173 | Username: app.Username, |
| 174 | } |
| 175 | u := *d.PathAppBaseURL |
| 176 | u.Host = strings.Replace(d.Options.AppHost, "*", appHost.String(), 1) |
| 177 | u.Path = "/" |
| 178 | u.RawQuery = app.Query |
| 179 | return &u |
| 180 | } |
| 181 | |
| 182 | // setupProxyTestWithFactory does the following: |
| 183 | // 1. Create a deployment with the factory. |