Change `projectOrName()` to check COMPOSE_PROJECT_NAME env var

Signed-off-by: Laura Brehm <laurabrehm@hey.com>
This commit is contained in:
Laura Brehm 2022-08-03 14:50:33 +02:00
parent be495ab8e6
commit c586ca4d0e
2 changed files with 5 additions and 1 deletions

View File

@ -142,6 +142,10 @@ func (o *projectOptions) projectOrName() (*types.Project, string, error) {
if o.ProjectName == "" {
p, err := o.toProject(nil)
if err != nil {
envProjectName := os.Getenv("COMPOSE_PROJECT_NAME")
if envProjectName != "" {
return nil, envProjectName, nil
}
return nil, "", err
}
project = p

View File

@ -2,4 +2,4 @@ services:
a-different-one:
image: nginx:alpine
and-another-one:
image: nginx:alpine
image: nginx:alpine