MCPcopy Index your code
hub / github.com/ddev/ddev / GetPrimaryRouterHTTPPort

Method GetPrimaryRouterHTTPPort

pkg/ddevapp/ddevapp.go:712–727  ·  view source on GitHub ↗

GetPrimaryRouterHTTPPort returns app's primary router http port It has to choose from (highest to lowest priority): 1. Empty string if webserver type is generic and no web_extra_exposed_ports are defined 2. The actual port configured into running container via DDEV_ROUTER_HTTP_PORT 3. The project ro

()

Source from the content-addressed store, hash-verified

710// 3. The project router_http_port
711// 4. The global router_http_port
712func (app *DdevApp) GetPrimaryRouterHTTPPort() string {
713 proposedPrimaryRouterHTTPPort := "80"
714 if globalconfig.DdevGlobalConfig.RouterHTTPPort != "" {
715 proposedPrimaryRouterHTTPPort = globalconfig.DdevGlobalConfig.RouterHTTPPort
716 }
717 if app.RouterHTTPPort != "" {
718 proposedPrimaryRouterHTTPPort = app.RouterHTTPPort
719 }
720 if httpPort := app.GetWebEnvVar("DDEV_ROUTER_HTTP_PORT"); httpPort != "" {
721 proposedPrimaryRouterHTTPPort = httpPort
722 }
723 if app.WebserverType == nodeps.WebserverGeneric && len(app.WebExtraExposedPorts) == 0 {
724 proposedPrimaryRouterHTTPPort = ""
725 }
726 return proposedPrimaryRouterHTTPPort
727}
728
729// GetWebEnvVar gets an environment variable from the web service
730// It returns empty string if there is no var or the ComposeYaml

Callers 13

DescribeMethod · 0.95
StartMethod · 0.95
DockerEnvMethod · 0.95
GetHTTPURLMethod · 0.95
GetAllURLsMethod · 0.95
TestHttpsRedirectionFunction · 0.80
TestEnvironmentVariablesFunction · 0.80
TestGlobalPortOverrideFunction · 0.80
TestUseEphemeralPortFunction · 0.80

Calls 1

GetWebEnvVarMethod · 0.95

Tested by 6

TestHttpsRedirectionFunction · 0.64
TestEnvironmentVariablesFunction · 0.64
TestGlobalPortOverrideFunction · 0.64
TestUseEphemeralPortFunction · 0.64