MCPcopy Create free account
hub / github.com/ddev/ddev / UpdateGlobalProjectList

Method UpdateGlobalProjectList

pkg/ddevapp/config.go:329–357  ·  view source on GitHub ↗

UpdateGlobalProjectList updates any information about project that is tracked in global project list: - approot - configured host ports Checks that configured host ports are not already reserved by another project

()

Source from the content-addressed store, hash-verified

327// Checks that configured host ports are not already
328// reserved by another project
329func (app *DdevApp) UpdateGlobalProjectList() error {
330 portsToReserve := []string{}
331 if app.HostDBPort != "" {
332 portsToReserve = append(portsToReserve, app.HostDBPort)
333 }
334 if app.HostWebserverPort != "" {
335 portsToReserve = append(portsToReserve, app.HostWebserverPort)
336 }
337 if app.HostHTTPSPort != "" {
338 portsToReserve = append(portsToReserve, app.HostHTTPSPort)
339 }
340
341 if len(portsToReserve) > 0 {
342 err := globalconfig.CheckHostPortsAvailable(app.Name, portsToReserve)
343 if err != nil {
344 return err
345 }
346 }
347 err := globalconfig.ReservePorts(app.Name, portsToReserve)
348 if err != nil {
349 return err
350 }
351 err = globalconfig.SetProjectAppRoot(app.Name, app.AppRoot)
352 if err != nil {
353 return err
354 }
355
356 return nil
357}
358
359// ReadConfig reads project configuration from the config.yaml file
360// It does not attempt to set default values; that's NewApp's job.

Callers 4

WriteConfigMethod · 0.95
StartMethod · 0.95
TestCmdDescribeFunction · 0.80
handleMainConfigArgsFunction · 0.80

Calls 3

CheckHostPortsAvailableFunction · 0.92
ReservePortsFunction · 0.92
SetProjectAppRootFunction · 0.92

Tested by 1

TestCmdDescribeFunction · 0.64