github.com/drud/ddev@v1.21.5-alpha1.0.20230226034409-94fcc4b94453/pkg/ddevapp/ports.go (about) 1 package ddevapp 2 3 import ( 4 "github.com/drud/ddev/pkg/nodeps" 5 "github.com/drud/ddev/pkg/util" 6 ) 7 8 // GetExposedPort returns the internal exposed port (as a string) for the given service. 9 // This can be used to find a given port for docker-compose manifests, 10 // or for automated testing. 11 func GetExposedPort(app *DdevApp, service string) string { 12 switch service { 13 case "db": 14 if app.Database.Type == nodeps.Postgres { 15 return "5432" 16 } 17 return "3306" 18 case "dba": 19 return "80" 20 case "mailhog": 21 return "8025" 22 case "web": 23 return "80" 24 } 25 26 util.Failed("Could not find port for service %s", service) 27 return "" 28 }