CheckForConf checks for a config.yaml at the cwd or parent dirs.
(confPath string)
| 147 | |
| 148 | // CheckForConf checks for a config.yaml at the cwd or parent dirs. |
| 149 | func 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. |
| 166 | func getTemplateFuncMap() map[string]any { |
no test coverage detected