From aa5cdf2bf9ae8b43183fb7aab56ebf3431033f24 Mon Sep 17 00:00:00 2001 From: Nicolas De Loof Date: Wed, 4 Jan 2023 12:41:36 +0100 Subject: [PATCH] add support for COMPOSE_PARALLEL_LIMIT (parity with Compose v1) Signed-off-by: Nicolas De Loof --- cmd/compose/compose.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cmd/compose/compose.go b/cmd/compose/compose.go index 04ada280b..55846dfb3 100644 --- a/cmd/compose/compose.go +++ b/cmd/compose/compose.go @@ -22,6 +22,7 @@ import ( "os" "os/signal" "path/filepath" + "strconv" "strings" "syscall" @@ -324,6 +325,13 @@ func RootCommand(streams api.Streams, backend api.Service) *cobra.Command { //no return err } } + if v, ok := os.LookupEnv("COMPOSE_PARALLEL_LIMIT"); ok && !cmd.Flags().Changed("parallel") { + i, err := strconv.Atoi(v) + if err != nil { + return fmt.Errorf("COMPOSE_PARALLEL_LIMIT must be an integer (found: %q)", v) + } + parallel = i + } if parallel > 0 { backend.MaxConcurrency(parallel) }