Skip to content
This repository was archived by the owner on Nov 27, 2023. It is now read-only.

Commit acfdd23

Browse files
authored
Merge pull request #1496 from docker/compose_profiles
add support for COMPOSE_PROFILES
2 parents 7866049 + 2f6a636 commit acfdd23

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

cli/cmd/compose/compose.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package compose
1919
import (
2020
"fmt"
2121
"os"
22+
"strings"
2223

2324
"github.com/compose-spec/compose-go/cli"
2425
"github.com/compose-spec/compose-go/types"
@@ -84,6 +85,10 @@ func (o *projectOptions) toProject(services []string, po ...cli.ProjectOptionsFn
8485
o.Profiles = append(o.Profiles, s.GetProfiles()...)
8586
}
8687

88+
if profiles, ok := options.Environment["COMPOSE_PROFILES"]; ok {
89+
o.Profiles = append(o.Profiles, strings.Split(profiles, ",")...)
90+
}
91+
8792
project.ApplyProfiles(o.Profiles)
8893

8994
err = project.ForServices(services)

0 commit comments

Comments
 (0)