add support for COMPOSE_PROFILES
@@ -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)
