From 0f9076562f35b02ddde1f589debc9b2dd1d445a7 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Fri, 23 Aug 2024 11:32:58 +0200 Subject: [PATCH] fix: parser parser --- app/Models/Application.php | 4 +-- bootstrap/helpers/shared.php | 27 ------------------- .../project/application/general.blade.php | 2 +- 3 files changed, 3 insertions(+), 30 deletions(-) diff --git a/app/Models/Application.php b/app/Models/Application.php index db76d07ec..f1621635b 100644 --- a/app/Models/Application.php +++ b/app/Models/Application.php @@ -126,7 +126,7 @@ class Application extends BaseModel ApplicationSetting::create([ 'application_id' => $application->id, ]); - $application->compose_parsing_version = '2'; + $application->compose_parsing_version = '3'; $application->save(); }); static::forceDeleting(function ($application) { @@ -1106,7 +1106,7 @@ class Application extends BaseModel if (! $this->docker_compose_raw) { return collect([]); } - if (isDev()) { + if ($this->compose_parsing_version === '3') { $compose = dockerComposeParserForApplications($this); return $compose; diff --git a/bootstrap/helpers/shared.php b/bootstrap/helpers/shared.php index 3d5346d47..32f63213e 100644 --- a/bootstrap/helpers/shared.php +++ b/bootstrap/helpers/shared.php @@ -1154,36 +1154,9 @@ function dockerComposeParserForApplications(Application $application): Collectio 'is_build_time' => false, 'is_preview' => false, ]); - } else { - // TODO: Should we add the variable to Coolify's DB? Maybe add a is_hardcoded column - $application->environment_variables()->where('key', $key)->where('application_id', $application->id)->firstOrCreate([ - 'key' => $key, - 'application_id' => $application->id, - 'is_preview' => false, - ], [ - 'value' => $value, - 'is_build_time' => false, - 'is_preview' => false, - ]); } } - // ray($environment); - $environment = $application->environment_variables()->where('application_id', $application->id)->get()->mapWithKeys(function ($item) { - return [$item['key'] => $item['value']]; - }); - - // if ($environment?->count() > 0) { - // $environment = $environment->map(function ($value, $key) use ($application) { - // $found = $application->environment_variables()->where('key', $key)->where('application_id', $application->id)->first(); - // if ($found) { - // $value = $found->value; - // } - - // return $value; - // }); - // } - // Labels $fqdns = collect([]); if ($application?->serviceType()) { diff --git a/resources/views/livewire/project/application/general.blade.php b/resources/views/livewire/project/application/general.blade.php index 36bf5b461..70bdaacb0 100644 --- a/resources/views/livewire/project/application/general.blade.php +++ b/resources/views/livewire/project/application/general.blade.php @@ -254,7 +254,7 @@ helper="You need to modify the docker compose file." monacoEditorLanguage="yaml" useMonacoEditor /> @else - @if (isDev()) + @if ($application->compose_parsing_version === '3')