ProjectConfigFile returns the path to project-level config file. It searches from the current directory upward for .aster/config.yaml
(startDir string)
| 175 | // ProjectConfigFile returns the path to project-level config file. |
| 176 | // It searches from the current directory upward for .aster/config.yaml |
| 177 | func ProjectConfigFile(startDir string) string { |
| 178 | dir := startDir |
| 179 | for { |
| 180 | configPath := filepath.Join(dir, ".aster", "config.yaml") |
| 181 | if _, err := os.Stat(configPath); err == nil { |
| 182 | return configPath |
| 183 | } |
| 184 | |
| 185 | parent := filepath.Dir(dir) |
| 186 | if parent == dir { |
| 187 | // Reached root |
| 188 | return "" |
| 189 | } |
| 190 | dir = parent |
| 191 | } |
| 192 | } |
| 193 | |
| 194 | // ResolveConfigFile returns the effective config file path. |
| 195 | // Priority: project config > global config |