refactor: Add default environment to Service model's saveComposeConfigs method

This commit is contained in:
Andras Bacsai 2024-06-24 20:58:54 +02:00
parent c3fb126a0a
commit b59799dc2b

View File

@ -841,6 +841,9 @@ public function saveComposeConfigs()
$json = Yaml::parse($this->docker_compose);
$envs_from_coolify = $this->environment_variables()->get();
foreach ($json['services'] as $service => $config) {
if (data_get($config, 'environment') === null) {
data_set($json, "services.$service.environment", []);
}
$envs = collect($config['environment']);
$envs->put('COOLIFY_CONTAINER_NAME', "$service-{$this->uuid}");
foreach ($envs_from_coolify as $env) {