From 68cd03d598e1d31887455a288f3e22267b36ba00 Mon Sep 17 00:00:00 2001 From: Matthew Vale Date: Thu, 3 Dec 2015 11:36:29 +0000 Subject: [PATCH] added workaround for lua not resolving localhost --- core/install/resources/classes/install_switch.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core/install/resources/classes/install_switch.php b/core/install/resources/classes/install_switch.php index 36db511cf4..dd64ee1d60 100644 --- a/core/install/resources/classes/install_switch.php +++ b/core/install/resources/classes/install_switch.php @@ -367,8 +367,10 @@ include "root.php"; $tmp .= " database[\"switch\"] = \"odbc://freeswitch:".$dsn_username.":".$dsn_password."\";\n"; } elseif ($this->global_settings->db_type() == "pgsql") { - $tmp .= " database[\"system\"] = \"pgsql://hostaddr=".$this->global_settings->db_host()." port=".$this->global_settings->db_port()." dbname=".$this->global_settings->db_name()." user=".$this->global_settings->db_username()." password=".$this->global_settings->db_password()." options='' application_name='".$this->global_settings->db_name()."'\";\n"; - $tmp .= " database[\"switch\"] = \"pgsql://hostaddr=".$this->global_settings->db_host()." port=".$this->global_settings->db_port()." dbname=freeswitch user=".$this->global_settings->db_username()." password=".$this->global_settings->db_password()." options='' application_name='freeswitch'\";\n"; + $lua_db_host = $this->global_settings->db_host(); + if($lua_db_host == 'localhost') { $lua_db_host = '127.0.0.1'; } // lua cannot resolve localhost + $tmp .= " database[\"system\"] = \"pgsql://hostaddr=".$lua_db_host." port=".$this->global_settings->db_port()." dbname=".$this->global_settings->db_name()." user=".$this->global_settings->db_username()." password=".$this->global_settings->db_password()." options='' application_name='".$this->global_settings->db_name()."'\";\n"; + $tmp .= " database[\"switch\"] = \"pgsql://hostaddr=".$lua_db_host." port=".$this->global_settings->db_port()." dbname=freeswitch user=".$this->global_settings->db_username()." password=".$this->global_settings->db_password()." options='' application_name='freeswitch'\";\n"; } elseif ($this->global_settings->db_type() == "sqlite") { $tmp .= " database[\"system\"] = \"sqlite://".$this->global_settings->db_path()."/".$this->global_settings->db_name()."\";\n";