refactor: Improve handling of default environment in Service model's saveComposeConfigs method

This commit is contained in:
Andras Bacsai 2024-06-24 20:59:24 +02:00
parent b59799dc2b
commit feadc60b14

View File

@ -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->put('COOLIFY_CONTAINER_NAME', "$service-{$this->uuid}");
foreach ($envs_from_coolify as $env) {
$envs = $envs->map(function ($value) use ($env) {