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)
| 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. |
| 219 | func (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" |