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

Function CheckForConf

pkg/ddevapp/utils.go:149–163  ·  view source on GitHub ↗

CheckForConf checks for a config.yaml at the cwd or parent dirs.

(confPath string)

Source from the content-addressed store, hash-verified

147
148// CheckForConf checks for a config.yaml at the cwd or parent dirs.
149func CheckForConf(confPath string) (string, error) {
150 if fileutil.FileExists(filepath.Join(confPath, ".ddev", "config.yaml")) {
151 return confPath, nil
152 }
153
154 // Keep going until we can't go any higher
155 for filepath.Dir(confPath) != confPath {
156 confPath = filepath.Dir(confPath)
157 if fileutil.FileExists(filepath.Join(confPath, ".ddev", "config.yaml")) {
158 return confPath, nil
159 }
160 }
161
162 return "", fmt.Errorf("no %s file was found in this directory or any parent", filepath.Join(".ddev", "config.yaml"))
163}
164
165// getTemplateFuncMap will return a map of useful template functions.
166func getTemplateFuncMap() map[string]any {

Callers 3

getConfigAppFunction · 0.92
SiteStatusMethod · 0.85
GetActiveAppRootFunction · 0.85

Calls 2

FileExistsFunction · 0.92
ErrorfMethod · 0.80

Tested by

no test coverage detected