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

Method GetPublishedPort

pkg/ddevapp/ddevapp.go:598–605  ·  view source on GitHub ↗

GetPublishedPort returns the host-exposed public port of a container.

(serviceName string)

Source from the content-addressed store, hash-verified

596
597// GetPublishedPort returns the host-exposed public port of a container.
598func (app *DdevApp) GetPublishedPort(serviceName string) (int, error) {
599 exposedPort := GetInternalPort(app, serviceName)
600 exposedPortInt, err := strconv.Atoi(exposedPort)
601 if err != nil {
602 return -1, err
603 }
604 return app.GetPublishedPortForPrivatePort(serviceName, uint16(exposedPortInt))
605}
606
607// GetPublishedPortForPrivatePort returns the host-exposed public port of a container for a given private port.
608func (app *DdevApp) GetPublishedPortForPrivatePort(serviceName string, privatePort uint16) (publicPort int, err error) {

Callers 5

DescribeMethod · 0.95
DockerEnvMethod · 0.95
TestEnvironmentVariablesFunction · 0.80
NewBackdropSettingsFunction · 0.80
NewDrupalSettingsFunction · 0.80

Calls 2

GetInternalPortFunction · 0.85

Tested by 1

TestEnvironmentVariablesFunction · 0.64