mirror of
https://github.com/docker/compose.git
synced 2025-12-16 02:04:00 +01:00
restore support for COMPOSE_COMPATIBILITY
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
parent
9fada6cc23
commit
c0345e4f45
@ -59,7 +59,7 @@ const (
|
||||
// ComposeProjectName define the project name to be used, instead of guessing from parent directory
|
||||
ComposeProjectName = "COMPOSE_PROJECT_NAME"
|
||||
// ComposeCompatibility try to mimic compose v1 as much as possible
|
||||
ComposeCompatibility = "COMPOSE_COMPATIBILITY"
|
||||
ComposeCompatibility = api.ComposeCompatibility
|
||||
// ComposeRemoveOrphans remove "orphaned" containers, i.e. containers tagged for current project but not declared as service
|
||||
ComposeRemoveOrphans = "COMPOSE_REMOVE_ORPHANS"
|
||||
// ComposeIgnoreOrphans ignore "orphaned" containers
|
||||
|
||||
20
pkg/api/env.go
Normal file
20
pkg/api/env.go
Normal file
@ -0,0 +1,20 @@
|
||||
/*
|
||||
Copyright 2020 Docker Compose CLI authors
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package api
|
||||
|
||||
// ComposeCompatibility try to mimic compose v1 as much as possible
|
||||
const ComposeCompatibility = "COMPOSE_COMPATIBILITY"
|
||||
@ -28,6 +28,7 @@ import (
|
||||
|
||||
"github.com/docker/compose/v5/pkg/api"
|
||||
"github.com/docker/compose/v5/pkg/remote"
|
||||
"github.com/docker/compose/v5/pkg/utils"
|
||||
)
|
||||
|
||||
// LoadProject implements api.Compose.LoadProject
|
||||
@ -48,7 +49,7 @@ func (s *composeService) LoadProject(ctx context.Context, options api.ProjectLoa
|
||||
}
|
||||
}
|
||||
|
||||
if options.Compatibility {
|
||||
if options.Compatibility || utils.StringToBool(projectOptions.Environment[api.ComposeCompatibility]) {
|
||||
api.Separator = "_"
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user