From 18201ece00132da40d51bf0ec4ee4bcba8ae4633 Mon Sep 17 00:00:00 2001 From: peaklabs-dev <122374094+peaklabs-dev@users.noreply.github.com> Date: Fri, 18 Oct 2024 21:17:57 +0200 Subject: [PATCH] fix remove postgres config if it is null or not set --- app/Actions/Database/StartPostgresql.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/Actions/Database/StartPostgresql.php b/app/Actions/Database/StartPostgresql.php index 3a2f9ce10..17cd6171f 100644 --- a/app/Actions/Database/StartPostgresql.php +++ b/app/Actions/Database/StartPostgresql.php @@ -214,10 +214,15 @@ class StartPostgresql private function add_custom_conf() { + $filename = 'custom-postgres.conf'; + $config_file_path = "$this->configuration_dir/$filename"; + if (is_null($this->database->postgres_conf) || empty($this->database->postgres_conf)) { + $this->commands[] = "rm -f $config_file_path"; + return; } - $filename = 'custom-postgres.conf'; + $content = $this->database->postgres_conf; if (! str($content)->contains('listen_addresses')) { $content .= "\nlisten_addresses = '*'"; @@ -225,6 +230,6 @@ class StartPostgresql $this->database->save(); } $content_base64 = base64_encode($content); - $this->commands[] = "echo '{$content_base64}' | base64 -d | tee $this->configuration_dir/{$filename} > /dev/null"; + $this->commands[] = "echo '{$content_base64}' | base64 -d | tee $config_file_path > /dev/null"; } }