From feadc60b14c217ace067855b5c1da89d1a74e144 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Mon, 24 Jun 2024 20:59:24 +0200 Subject: [PATCH] refactor: Improve handling of default environment in Service model's saveComposeConfigs method --- app/Models/Service.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/Models/Service.php b/app/Models/Service.php index 82e1b6c8f..36d7aa9c3 100644 --- a/app/Models/Service.php +++ b/app/Models/Service.php @@ -843,8 +843,10 @@ public function saveComposeConfigs() foreach ($json['services'] as $service => $config) { if (data_get($config, 'environment') === null) { data_set($json, "services.$service.environment", []); + $envs = collect([]); + } else { + $envs = collect($config['environment']); } - $envs = collect($config['environment']); $envs->put('COOLIFY_CONTAINER_NAME', "$service-{$this->uuid}"); foreach ($envs_from_coolify as $env) { $envs = $envs->map(function ($value) use ($env) {