GetAllURLs returns an array of all the URLs for the project
()
| 3477 | |
| 3478 | // GetAllURLs returns an array of all the URLs for the project |
| 3479 | func (app *DdevApp) GetAllURLs() (httpURLs []string, httpsURLs []string, allURLs []string) { |
| 3480 | if nodeps.IsCodespaces() { |
| 3481 | codespaceName := os.Getenv("CODESPACE_NAME") |
| 3482 | previewDomain := os.Getenv("GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN") |
| 3483 | if codespaceName != "" && previewDomain != "" { |
| 3484 | url := fmt.Sprintf("https://%s-%s.%s", codespaceName, app.HostWebserverPort, previewDomain) |
| 3485 | httpsURLs = append(httpsURLs, netutil.NormalizeURL(url)) |
| 3486 | } |
| 3487 | } |
| 3488 | |
| 3489 | // Get configured URLs |
| 3490 | for _, name := range app.GetHostnames() { |
| 3491 | httpPort := app.GetPrimaryRouterHTTPPort() |
| 3492 | httpsPort := app.GetPrimaryRouterHTTPSPort() |
| 3493 | |
| 3494 | // It's possible for no https default to be configured |
| 3495 | if !app.CanUseHTTPOnly() && httpsPort != "" { |
| 3496 | httpsURL := netutil.NormalizeURL("https://" + name + ":" + httpsPort) |
| 3497 | httpsURLs = append(httpsURLs, httpsURL) |
| 3498 | } |
| 3499 | if httpPort != "" { |
| 3500 | httpURL := netutil.NormalizeURL("http://" + name + ":" + httpPort) |
| 3501 | httpURLs = append(httpURLs, httpURL) |
| 3502 | } |
| 3503 | } |
| 3504 | |
| 3505 | if !IsRouterDisabled(app) && !app.CanUseHTTPOnly() { |
| 3506 | if directHTTPSURL := app.GetWebContainerDirectHTTPSURL(); directHTTPSURL != "" { |
| 3507 | httpsURLs = append(httpsURLs, directHTTPSURL) |
| 3508 | } |
| 3509 | } |
| 3510 | if directHTTPURL := app.GetWebContainerDirectHTTPURL(); directHTTPURL != "" { |
| 3511 | httpURLs = append(httpURLs, app.GetWebContainerDirectHTTPURL()) |
| 3512 | } |
| 3513 | |
| 3514 | allURLs = append(httpsURLs, httpURLs...) |
| 3515 | return httpURLs, httpsURLs, allURLs |
| 3516 | } |
| 3517 | |
| 3518 | // GetPrimaryURL returns the primary URL that can be used, https or http |
| 3519 | func (app *DdevApp) GetPrimaryURL() string { |