Merge pull request #1496 from docker/compose_profiles

add support for COMPOSE_PROFILES
This commit is contained in:
Nicolas De loof 2021-04-06 11:55:37 +02:00 committed by GitHub
commit acfdd2349b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -19,6 +19,7 @@ package compose
import (
"fmt"
"os"
"strings"
"github.com/compose-spec/compose-go/cli"
"github.com/compose-spec/compose-go/types"
@ -84,6 +85,10 @@ func (o *projectOptions) toProject(services []string, po ...cli.ProjectOptionsFn
o.Profiles = append(o.Profiles, s.GetProfiles()...)
}
if profiles, ok := options.Environment["COMPOSE_PROFILES"]; ok {
o.Profiles = append(o.Profiles, strings.Split(profiles, ",")...)
}
project.ApplyProfiles(o.Profiles)
err = project.ForServices(services)