Skip to content

Commit c586ca4

Browse files
committed
Change projectOrName() to check COMPOSE_PROJECT_NAME env var
Signed-off-by: Laura Brehm <[email protected]>
1 parent be495ab commit c586ca4

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

cmd/compose/compose.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,10 @@ func (o *projectOptions) projectOrName() (*types.Project, string, error) {
142142
if o.ProjectName == "" {
143143
p, err := o.toProject(nil)
144144
if err != nil {
145+
envProjectName := os.Getenv("COMPOSE_PROJECT_NAME")
146+
if envProjectName != "" {
147+
return nil, envProjectName, nil
148+
}
145149
return nil, "", err
146150
}
147151
project = p

pkg/e2e/fixtures/start-stop/other.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ services:
22
a-different-one:
33
image: nginx:alpine
44
and-another-one:
5-
image: nginx:alpine
5+
image: nginx:alpine

0 commit comments

Comments
 (0)