From 900308afec640c45897e216a58bc59121236ce7f Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Thu, 23 May 2024 14:28:11 +0200 Subject: [PATCH] fix: better way to add curl/wget to nixpacks --- app/Jobs/ApplicationDeploymentJob.php | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/app/Jobs/ApplicationDeploymentJob.php b/app/Jobs/ApplicationDeploymentJob.php index 315898a7c..40ae43428 100644 --- a/app/Jobs/ApplicationDeploymentJob.php +++ b/app/Jobs/ApplicationDeploymentJob.php @@ -1257,16 +1257,21 @@ private function generate_nixpacks_confs() // Do any modifications here $this->generate_env_variables(); $merged_envs = $this->env_args->merge(collect(data_get($parsed, 'variables', []))); - $aptPkgs = data_get($parsed, 'phases.setup.aptPkgs'); - if (!in_array('curl', $aptPkgs)) { - $aptPkgs[] = 'curl'; + $aptPkgs = data_get($parsed, 'phases.setup.aptPkgs', []); + if (count($aptPkgs) === 0) { + data_set($parsed, 'phases.setup.aptPkgs', ['curl', 'wget']); + } else { + if (!in_array('curl', $aptPkgs)) { + $aptPkgs[] = 'curl'; + } + if (!in_array('wget', $aptPkgs)) { + $aptPkgs[] = 'wget'; + } + data_set($parsed, 'phases.setup.aptPkgs', $aptPkgs); } - if (!in_array('wget', $aptPkgs)) { - $aptPkgs[] = 'wget'; - } - data_set($parsed, 'phases.setup.aptPkgs', $aptPkgs); data_set($parsed, 'variables', $merged_envs->toArray()); $this->nixpacks_plan = json_encode($parsed, JSON_PRETTY_PRINT); + $this->application_deployment_queue->addLogEntry("Final Nixpacks plan: {$this->nixpacks_plan}", hidden: true); } } }