Skip to content

Commit b27656c

Browse files
remove obsolete project name fallback
Since #599, we already consider the COMPOSE_PROJECT_NAME env var when loading the project name, so this fallback is redundant. We also want to suggest using the --project-name flag instead of the env var.
1 parent eccd03e commit b27656c

File tree

1 file changed

+1
-15
lines changed

1 file changed

+1
-15
lines changed

src/pkg/cli/client/byoc/baseclient.go

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@ package byoc
33
import (
44
"context"
55
"errors"
6-
"fmt"
7-
"os"
8-
"slices"
96
"strings"
107

118
"github.com/DefangLabs/defang/src/pkg"
@@ -14,7 +11,6 @@ import (
1411
"github.com/DefangLabs/defang/src/pkg/term"
1512
"github.com/DefangLabs/defang/src/pkg/types"
1613
defangv1 "github.com/DefangLabs/defang/src/protos/io/defang/v1"
17-
"github.com/compose-spec/compose-go/v2/consts"
1814
compose "github.com/compose-spec/compose-go/v2/types"
1915
)
2016

@@ -148,17 +144,7 @@ func (b *ByocBaseClient) loadProjectNameFromRemote(ctx context.Context) (string,
148144
return projectNames[0], nil
149145
}
150146

151-
// When there are multiple projects, take a hint from COMPOSE_PROJECT_NAME environment variable if set
152-
if projectName, ok := os.LookupEnv(consts.ComposeProjectName); ok {
153-
if !slices.Contains(projectNames, projectName) {
154-
return "", fmt.Errorf("project %q specified by COMPOSE_PROJECT_NAME not found", projectName)
155-
}
156-
term.Debug("Using project from COMPOSE_PROJECT_NAME environment variable:", projectName)
157-
b.setProjectName(projectName)
158-
return projectName, nil
159-
}
160-
161-
return "", errors.New("multiple projects found; please go to the correct project directory where the compose file is or set COMPOSE_PROJECT_NAME")
147+
return "", errors.New("multiple projects found; use the --project-name flag to specify a project")
162148
}
163149

164150
func (b *ByocBaseClient) setProjectName(projectName string) {

0 commit comments

Comments
 (0)