fix remove postgres config if it is null or not set
This commit is contained in:
parent
159c4aa7ac
commit
18201ece00
1 changed files with 7 additions and 2 deletions
|
|
@ -214,10 +214,15 @@ private function generate_init_scripts()
|
|||
|
||||
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 @@ private function add_custom_conf()
|
|||
$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";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue