refactor: Convert service variables to key-value pairs in parseDockerComposeFile function
This commit is contained in:
parent
fe89269b4b
commit
7d78e0171d
1 changed files with 15 additions and 0 deletions
|
|
@ -1726,6 +1726,21 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
|
||||||
data_set($service, 'volumes', $serviceVolumes->toArray());
|
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
|
// Get variables from the service
|
||||||
foreach ($serviceVariables as $variableName => $variable) {
|
foreach ($serviceVariables as $variableName => $variable) {
|
||||||
if (is_numeric($variableName)) {
|
if (is_numeric($variableName)) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue