From 7d78e0171d260dfce08c2cd50ff10eb7d61b9723 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Sat, 24 Aug 2024 11:00:27 +0200 Subject: [PATCH] refactor: Convert service variables to key-value pairs in parseDockerComposeFile function --- bootstrap/helpers/shared.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/bootstrap/helpers/shared.php b/bootstrap/helpers/shared.php index 4e2ba5a9d..8924f88f7 100644 --- a/bootstrap/helpers/shared.php +++ b/bootstrap/helpers/shared.php @@ -1726,6 +1726,21 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal data_set($service, 'volumes', $serviceVolumes->toArray()); } + // convert - SESSION_SECRET: 123 to - SESSION_SECRET=123 + $convertedServiceVariables = collect([]); + foreach ($serviceVariables as $variableName => $variable) { + if (is_numeric($variableName)) { + if (is_array($variable)) { + $key = str(collect($variable)->keys()->first()); + $value = str(collect($variable)->values()->first()); + $variable = "$key=$value"; + $convertedServiceVariables->put($variableName, $variable); + } elseif (is_string($variable)) { + $convertedServiceVariables->put($variableName, $variable); + } + } + } + $serviceVariables = $convertedServiceVariables; // Get variables from the service foreach ($serviceVariables as $variableName => $variable) { if (is_numeric($variableName)) {