WIP: default to compose.yml instead of all of 'em

This commit is contained in:
3wc 2021-10-12 10:25:37 +02:00
parent 84489495dc
commit a0b4886eba
1 changed files with 5 additions and 7 deletions

View File

@ -334,17 +334,15 @@ func GetAppStatuses(appFiles AppFiles) (map[string]map[string]string, error) {
// GetAppComposeFiles gets the list of compose files for an app which should be
// merged into a composetypes.Config while respecting the COMPOSE_FILE env var.
func GetAppComposeFiles(recipe string, appEnv AppEnv) ([]string, error) {
var composeFiles []string
if _, ok := appEnv["COMPOSE_FILE"]; !ok {
logrus.Debug("no COMPOSE_FILE detected, loading all compose files")
pattern := fmt.Sprintf("%s/%s/compose**yml", APPS_DIR, recipe)
composeFiles, err := filepath.Glob(pattern)
if err != nil {
return composeFiles, err
}
logrus.Debug("no COMPOSE_FILE detected, loading compose.yml")
path := fmt.Sprintf("%s/%s/compose.yml", APPS_DIR, recipe)
composeFiles = append (composeFiles, path)
return composeFiles, nil
}
var composeFiles []string
composeFileEnvVar := appEnv["COMPOSE_FILE"]
envVars := strings.Split(composeFileEnvVar, ":")
logrus.Debugf("COMPOSE_FILE detected ('%s'), loading '%s'", composeFileEnvVar, strings.Join(envVars, ", "))