Update app/Jobs/ApplicationDeploymentJob.php

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
This commit is contained in:
Andras Bacsai 2025-09-16 18:26:12 +02:00 committed by GitHub
parent f084ded6e9
commit f5e17337f4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -2873,8 +2873,9 @@ private function add_build_secrets_to_compose($composeFile)
// Add top-level secrets definition
$secrets = [];
foreach ($variables as $env) {
$safe_filename = preg_replace('/[^A-Za-z0-9._-]/', '_', (string) $env->key);
$secrets[$env->key] = [
'file' => "{$this->secrets_dir}/{$env->key}",
'file' => "{$this->secrets_dir}/{$safe_filename}",
];
}
@ -2904,7 +2905,9 @@ private function add_build_secrets_to_compose($composeFile)
// Update the compose file
$composeFile['services'] = $services;
$composeFile['secrets'] = $secrets;
// merge with existing secrets if present
$existingSecrets = data_get($composeFile, 'secrets', []);
$composeFile['secrets'] = array_replace($existingSecrets, $secrets);
$this->application_deployment_queue->addLogEntry('Added build secrets configuration to docker-compose file.');