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

Function getConfigApp

cmd/ddev/cmd/config.go:338–361  ·  view source on GitHub ↗

getConfigApp() does the basic setup of the app (with provider) and returns it.

(_ string)

Source from the content-addressed store, hash-verified

336
337// getConfigApp() does the basic setup of the app (with provider) and returns it.
338func getConfigApp(_ string) *ddevapp.DdevApp {
339 appRoot, err := os.Getwd()
340 if err != nil {
341 util.Failed("Could not determine the current working directory: %v", err)
342 }
343
344 // Check for an existing config in a parent dir
345 otherRoot, _ := ddevapp.CheckForConf(appRoot)
346 if otherRoot != "" && otherRoot != appRoot {
347 appRoot = otherRoot
348 err = os.Chdir(appRoot)
349 if err != nil {
350 util.Failed("Unable to chdir to %v: %v", appRoot, err)
351 }
352 }
353 app, err := ddevapp.NewApp(appRoot, false)
354 if err != nil {
355 util.Failed("Could not create a new config: %v", err)
356 }
357 if hasConfigNameOverride, newName := app.HasConfigNameOverride(); hasConfigNameOverride {
358 app.Name = newName
359 }
360 return app
361}
362
363// handleMainConfigArgs() validates and processes the main config args (docroot, etc.)
364func handleMainConfigArgs(cmd *cobra.Command, _ []string, app *ddevapp.DdevApp) error {

Callers 1

handleConfigRunFunction · 0.85

Calls 5

FailedFunction · 0.92
CheckForConfFunction · 0.92
NewAppFunction · 0.92
ChdirMethod · 0.80
HasConfigNameOverrideMethod · 0.80

Tested by

no test coverage detected