Skip to content

Commit 364589e

Browse files
committed
restore support for COMPOSE_COMPATIBILITY
Signed-off-by: Nicolas De Loof <[email protected]>
1 parent 9fada6c commit 364589e

File tree

3 files changed

+23
-2
lines changed

3 files changed

+23
-2
lines changed

cmd/compose/compose.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ const (
5959
// ComposeProjectName define the project name to be used, instead of guessing from parent directory
6060
ComposeProjectName = "COMPOSE_PROJECT_NAME"
6161
// ComposeCompatibility try to mimic compose v1 as much as possible
62-
ComposeCompatibility = "COMPOSE_COMPATIBILITY"
62+
ComposeCompatibility = api.ComposeCompatibility
6363
// ComposeRemoveOrphans remove "orphaned" containers, i.e. containers tagged for current project but not declared as service
6464
ComposeRemoveOrphans = "COMPOSE_REMOVE_ORPHANS"
6565
// ComposeIgnoreOrphans ignore "orphaned" containers

pkg/api/env.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
Copyright 2020 Docker Compose CLI authors
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package api
18+
19+
// ComposeCompatibility try to mimic compose v1 as much as possible
20+
const ComposeCompatibility = "COMPOSE_COMPATIBILITY"

pkg/compose/loader.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import (
2828

2929
"github.com/docker/compose/v5/pkg/api"
3030
"github.com/docker/compose/v5/pkg/remote"
31+
"github.com/docker/compose/v5/pkg/utils"
3132
)
3233

3334
// LoadProject implements api.Compose.LoadProject
@@ -48,7 +49,7 @@ func (s *composeService) LoadProject(ctx context.Context, options api.ProjectLoa
4849
}
4950
}
5051

51-
if options.Compatibility {
52+
if options.Compatibility || utils.StringToBool(projectOptions.Environment[api.ComposeCompatibility]) {
5253
api.Separator = "_"
5354
}
5455

0 commit comments

Comments
 (0)