An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.
PHP coolifydatabasesdeploymentdockerdocker-composeinertiajslaravelmariadbmysqlnextjsnodejsphppostgresredisself-hostedself-hostingserverstatic-sitesveltesvelte5
rename parser functions
Andras Bacsaife89269b4b44
diff --git a/app/Jobs/ApplicationDeploymentJob.php b/app/Jobs/ApplicationDeploymentJob.phpindex f9fdeabe4f..a3188c3435 100644--- a/app/Jobs/ApplicationDeploymentJob.php+++ b/app/Jobs/ApplicationDeploymentJob.php@@ -451,11 +451,11 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueue$this->cleanup_git();$this->application->loadComposeFile(isInit: false);if ($this->application->settings->is_raw_compose_deployment_enabled) {- $this->application->parseRawCompose();+ $this->application->oldRawParser();$yaml = $composeFile = $this->application->docker_compose_raw;$this->save_environment_variables();} else {- $composeFile = $this->application->parseCompose(pull_request_id: $this->pull_request_id, preview_id: data_get($this->preview, 'id'));+ $composeFile = $this->application->oldParser(pull_request_id: $this->pull_request_id, preview_id: data_get($this->preview, 'id'));$this->save_environment_variables();if (! is_null($this->env_filename)) {$services = collect($composeFile['services']);diff --git a/app/Livewire/Project/Application/Advanced.php b/app/Livewire/Project/Application/Advanced.phpindex 32a1eb7048..f037dcef9a 100644--- a/app/Livewire/Project/Application/Advanced.php+++ b/app/Livewire/Project/Application/Advanced.php@@ -66,9 +66,9 @@ class Advanced extends Component$this->dispatch('resetDefaultLabels', false);}if ($this->application->settings->is_raw_compose_deployment_enabled) {- $this->application->parseRawCompose();+ $this->application->oldRawParser();} else {- $this->application->parseCompose();+ $this->application->oldParser();}$this->application->settings->save();$this->dispatch('success', 'Settings saved.');diff --git a/app/Livewire/Project/Application/General.php b/app/Livewire/Project/Application/General.phpindex 7f78a067e1..fedbdaabd1 100644--- a/app/Livewire/Project/Application/General.php+++ b/app/Livewire/Project/Application/General.php@@ -132,7 +132,7 @@ class General extends Componentpublic function mount(){try {- $this->parsedServices = $this->application->parseCompose();+ $this->parsedServices = $this->application->oldParser();if (is_null($this->parsedServices) || empty($this->parsedServices)) {$this->dispatch('error', 'Failed to parse your docker-compose file. Please check the syntax and try again.');@@ -205,7 +205,7 @@ class General extends Componentreturn;}- $this->application->parseCompose();+ $this->application->oldParser();$this->dispatch('success', 'Docker compose file loaded.');$this->dispatch('compose_loaded');$this->dispatch('refreshStorages');diff --git a/app/Livewire/Project/Shared/ScheduledTask/All.php b/app/Livewire/Project/Shared/ScheduledTask/All.phpindex 4d8c87dbf6..0df3040b84 100644--- a/app/Livewire/Project/Shared/ScheduledTask/All.php+++ b/app/Livewire/Project/Shared/ScheduledTask/All.php@@ -26,7 +26,7 @@ class All extends Component$this->containerNames = $this->containerNames->merge($this->resource->databases()->pluck('name'));} elseif ($this->resource->type() == 'application') {if ($this->resource->build_pack === 'dockercompose') {- $parsed = $this->resource->parseCompose();+ $parsed = $this->resource->oldParser();$containers = collect(data_get($parsed, 'services'))->keys();$this->containerNames = $containers;} else {diff --git a/app/Models/Application.php b/app/Models/Application.phpindex 50f285d095..f7bd6c190a 100644--- a/app/Models/Application.php+++ b/app/Models/Application.php@@ -1025,7 +1025,7 @@ class Application extends BaseModel}}- public function parseRawCompose()+ public function oldRawParser(){try {$yaml = Yaml::parse($this->docker_compose_raw);@@ -1085,7 +1085,7 @@ class Application extends BaseModelinstant_remote_process($commands, $this->destination->server, false);}- public function dockerComposeParser(int $pull_request_id = 0, ?int $preview_id = null)+ public function newParser(int $pull_request_id = 0, ?int $preview_id = null){$pullRequestId = $pull_request_id;$isPullRequest = $pullRequestId == 0 ? false : true;@@ -1624,10 +1624,10 @@ class Application extends BaseModelreturn $topLevel;}- public function parseCompose(int $pull_request_id = 0, ?int $preview_id = null)+ public function oldParser(int $pull_request_id = 0, ?int $preview_id = null){if ($this->compose_parsing_version === '3') {- return $this->dockerComposeParser($pull_request_id, $preview_id);+ return $this->newParser($pull_request_id, $preview_id);} elseif ($this->docker_compose_raw) {return parseDockerComposeFile(resource: $this, isNew: false, pull_request_id: $pull_request_id, preview_id: $preview_id);@@ -1681,7 +1681,7 @@ class Application extends BaseModelif ($composeFileContent) {$this->docker_compose_raw = $composeFileContent;$this->save();- $parsedServices = $this->parseCompose();+ $parsedServices = $this->oldParser();if ($this->docker_compose_domains) {$json = collect(json_decode($this->docker_compose_domains));$names = collect(data_get($parsedServices, 'services'))->keys()->toArray();diff --git a/app/Models/ApplicationPreview.php b/app/Models/ApplicationPreview.phpindex 57d20e3aa6..ff96ef0924 100644--- a/app/Models/ApplicationPreview.php+++ b/app/Models/ApplicationPreview.php@@ -14,7 +14,7 @@ class ApplicationPreview extends BaseModelstatic::deleting(function ($preview) {if ($preview->application->build_pack === 'dockercompose') {$server = $preview->application->destination->server;- $composeFile = $preview->application->parseCompose(pull_request_id: $preview->pull_request_id);+ $composeFile = $preview->application->oldParser(pull_request_id: $preview->pull_request_id);$volumes = data_get($composeFile, 'volumes');$networks = data_get($composeFile, 'networks');$networkKeys = collect($networks)->keys();diff --git a/tests/Feature/DockerComposeParseTest.php b/tests/Feature/DockerComposeParseTest.phpindex fc97959d22..c3263bc75b 100644--- a/tests/Feature/DockerComposeParseTest.php+++ b/tests/Feature/DockerComposeParseTest.php@@ -93,8 +93,8 @@ afterEach(function () {test('ComposeParse', function () {expect($this->jsonComposeFile)->toBeJson()->ray();- $output = $this->application->dockerComposeParser();- $outputOld = $this->application->parseCompose();+ $output = $this->application->newParser();+ $outputOld = $this->application->oldParser();expect($output)->toBeInstanceOf(Collection::class);expect($outputOld)->toBeInstanceOf(Collection::class);@@ -175,8 +175,8 @@ test('ComposeParsePreviewDeployment', function () {$previewId = 77;expect($this->jsonComposeFile)->toBeJson()->ray();- $output = $this->application->dockerComposeParser(pull_request_id: $pullRequestId, preview_id: $previewId);- $outputOld = $this->application->parseCompose();+ $output = $this->application->newParser(pull_request_id: $pullRequestId, preview_id: $previewId);+ $outputOld = $this->application->oldParser();expect($output)->toBeInstanceOf(Collection::class);expect($outputOld)->toBeInstanceOf(Collection::class);