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

Method Describe

pkg/ddevapp/ddevapp.go:219–595  ·  view source on GitHub ↗

Describe returns a map which provides detailed information on services associated with the running site. if short==true, then only the basic information is returned.

(short bool)

Source from the content-addressed store, hash-verified

217// Describe returns a map which provides detailed information on services associated with the running site.
218// if short==true, then only the basic information is returned.
219func (app *DdevApp) Describe(short bool) (map[string]any, error) {
220 _ = app.DockerEnv()
221 err := app.ProcessHooks("pre-describe")
222 if err != nil {
223 return nil, fmt.Errorf("failed to process pre-describe hooks: %v", err)
224 }
225
226 shortRoot := fileutil.ShortHomeJoin(app.GetAppRoot())
227 appDesc := make(map[string]any)
228 status, statusDesc := app.SiteStatus()
229
230 appDesc["name"] = app.GetName()
231 appDesc["status"] = status
232 appDesc["status_desc"] = statusDesc
233 appDesc["approot"] = app.GetAppRoot()
234 appDesc["docroot"] = app.GetDocroot()
235 appDesc["shortroot"] = shortRoot
236 if app.WebserverType != nodeps.WebserverGeneric {
237 appDesc["httpurl"] = app.GetHTTPURL()
238 appDesc["httpsurl"] = app.GetHTTPSURL()
239 }
240 appDesc["mailpit_https_url"] = "https://" + app.GetHostname() + ":" + app.GetMailpitHTTPSPort()
241 appDesc["mailpit_url"] = "http://" + app.GetHostname() + ":" + app.GetMailpitHTTPPort()
242 appDesc["xhgui_https_url"] = "https://" + app.GetHostname() + ":" + app.GetXHGuiHTTPSPort()
243 appDesc["xhgui_url"] = "http://" + app.GetHostname() + ":" + app.GetXHGuiHTTPPort()
244 appDesc["router_disabled"] = IsRouterDisabled(app)
245 appDesc["primary_url"] = app.GetPrimaryURL()
246 appDesc["type"] = app.GetType()
247 appDesc["mutagen_enabled"] = app.IsMutagenEnabled()
248 appDesc["nodejs_version"] = app.NodeJSVersion
249 appDesc["router"] = globalconfig.DdevGlobalConfig.Router
250 if app.IsMutagenEnabled() {
251 appDesc["mutagen_status"], _, _, err = app.MutagenStatus()
252 if err != nil {
253 appDesc["mutagen_status"] = err.Error() + " " + appDesc["mutagen_status"].(string)
254 }
255 }
256
257 // If short is set, we don't need more information, so return what we have.
258 if short {
259 return appDesc, nil
260 }
261 appDesc["hostname"] = app.GetHostname()
262 appDesc["hostnames"] = app.GetHostnames()
263 appDesc["performance_mode"] = app.GetPerformanceMode()
264 appDesc["fail_on_hook_fail"] = app.FailOnHookFail || app.FailOnHookFailGlobal
265 httpURLs, httpsURLs, allURLs := app.GetAllURLs()
266 appDesc["httpURLs"] = httpURLs
267 appDesc["httpsURLs"] = httpsURLs
268 appDesc["urls"] = allURLs
269
270 appDesc["database_type"] = app.Database.Type
271 appDesc["database_version"] = app.Database.Version
272
273 if !nodeps.ArrayContainsString(app.GetOmittedContainers(), "db") {
274 dbinfo := make(map[string]any)
275 dbinfo["username"] = "db"
276 dbinfo["password"] = "db"

Callers 15

GetXHGuiURLMethod · 0.95
TestDdevDescribeFunction · 0.95
TestMutagenSimpleFunction · 0.95
TestHostDBPortFunction · 0.80
TestMailpitFunction · 0.80
TestListWithoutDirFunction · 0.80
TestGlobalPortOverrideFunction · 0.80
TestTraefikSimpleFunction · 0.80
TestTraefikVirtualHostFunction · 0.80
TestMultipleComposeFilesFunction · 0.80
ListFunction · 0.80
loadDetailCmdFunction · 0.80

Calls 15

DockerEnvMethod · 0.95
ProcessHooksMethod · 0.95
GetAppRootMethod · 0.95
SiteStatusMethod · 0.95
GetNameMethod · 0.95
GetDocrootMethod · 0.95
GetHTTPURLMethod · 0.95
GetHTTPSURLMethod · 0.95
GetHostnameMethod · 0.95
GetMailpitHTTPSPortMethod · 0.95
GetMailpitHTTPPortMethod · 0.95
GetXHGuiHTTPSPortMethod · 0.95

Tested by 14

TestDdevDescribeFunction · 0.76
TestMutagenSimpleFunction · 0.76
TestHostDBPortFunction · 0.64
TestMailpitFunction · 0.64
TestListWithoutDirFunction · 0.64
TestGlobalPortOverrideFunction · 0.64
TestTraefikSimpleFunction · 0.64
TestTraefikVirtualHostFunction · 0.64
TestMultipleComposeFilesFunction · 0.64
TestDrupalAppTypeUsageFunction · 0.64
TestCmdXHGuiFunction · 0.64
TestLaunchCommandFunction · 0.64