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

View File

@@ -2873,8 +2873,9 @@ COPY ./nginx.conf /etc/nginx/conf.d/default.conf");
// Add top-level secrets definition // Add top-level secrets definition
$secrets = []; $secrets = [];
foreach ($variables as $env) { foreach ($variables as $env) {
$safe_filename = preg_replace('/[^A-Za-z0-9._-]/', '_', (string) $env->key);
$secrets[$env->key] = [ $secrets[$env->key] = [
'file' => "{$this->secrets_dir}/{$env->key}", 'file' => "{$this->secrets_dir}/{$safe_filename}",
]; ];
} }
@@ -2904,7 +2905,9 @@ COPY ./nginx.conf /etc/nginx/conf.d/default.conf");
// Update the compose file // Update the compose file
$composeFile['services'] = $services; $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.'); $this->application_deployment_queue->addLogEntry('Added build secrets configuration to docker-compose file.');