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

Method GetWebEnvVar

pkg/ddevapp/ddevapp.go:732–743  ·  view source on GitHub ↗

GetWebEnvVar gets an environment variable from the web service It returns empty string if there is no var or the ComposeYaml is just not set.

(name string)

Source from the content-addressed store, hash-verified

730// It returns empty string if there is no var or the ComposeYaml
731// is just not set.
732func (app *DdevApp) GetWebEnvVar(name string) string {
733 if app.ComposeYaml != nil && app.ComposeYaml.Services != nil {
734 if service, ok := app.ComposeYaml.Services["web"]; ok {
735 if service.Environment != nil {
736 if v, ok := service.Environment[name]; ok && v != nil {
737 return *v
738 }
739 }
740 }
741 }
742 return ""
743}
744
745// TargetPortFromExposeVariable uses a string like HTTP_EXPOSE or HTTPS_EXPOSE, which is a
746// comma-delimited list of colon-delimited port-pairs

Callers 4

GetMailpitHTTPPortMethod · 0.95
GetMailpitHTTPSPortMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected