use StringToBool to detect COMPOSE_IGNORE_ORPHANS

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
Nicolas De Loof 2022-12-01 09:37:45 +01:00
parent 8f2b747104
commit 7369127650
No known key found for this signature in database
GPG Key ID: 9858809D6F8F6E7E
1 changed files with 2 additions and 2 deletions

View File

@ -32,6 +32,7 @@ import (
"github.com/docker/cli/cli" "github.com/docker/cli/cli"
"github.com/docker/compose/v2/pkg/api" "github.com/docker/compose/v2/pkg/api"
"github.com/docker/compose/v2/pkg/progress" "github.com/docker/compose/v2/pkg/progress"
"github.com/docker/compose/v2/pkg/utils"
) )
type runOptions struct { type runOptions struct {
@ -140,8 +141,7 @@ func runCommand(p *projectOptions, dockerCli command.Cli, backend api.Service) *
if err != nil { if err != nil {
return err return err
} }
ignore := project.Environment["COMPOSE_IGNORE_ORPHANS"] opts.ignoreOrphans = utils.StringToBool(project.Environment["COMPOSE_IGNORE_ORPHANS"])
opts.ignoreOrphans = strings.ToLower(ignore) == "true"
return runRun(ctx, backend, project, opts, createOpts) return runRun(ctx, backend, project, opts, createOpts)
}), }),
ValidArgsFunction: completeServiceNames(p), ValidArgsFunction: completeServiceNames(p),