From 278e65c2e192becbf3f5520034a33954efa3ef8e Mon Sep 17 00:00:00 2001 From: Gill Abada Date: Fri, 31 Jul 2020 11:17:08 -0400 Subject: [PATCH] make database host dynamic. (#334) Co-authored-by: Gill Abada --- centos/resources/finish.sh | 1 + centos/resources/fusionpbx/config.php | 2 +- debian/resources/finish.sh | 1 + debian/resources/fusionpbx/config.php | 2 +- devuan/resources/finish.sh | 1 + devuan/resources/fusionpbx/config.php | 2 +- freebsd/resources/finish.sh | 1 + freebsd/resources/fusionpbx/config.php | 2 +- ubuntu/resources/finish.sh | 1 + ubuntu/resources/fusionpbx/config.php | 2 +- 10 files changed, 10 insertions(+), 5 deletions(-) diff --git a/centos/resources/finish.sh b/centos/resources/finish.sh index 6a3367c..a7e2f6d 100755 --- a/centos/resources/finish.sh +++ b/centos/resources/finish.sh @@ -26,6 +26,7 @@ sudo -u postgres /usr/pgsql-9.4/bin/psql -c "ALTER USER freeswitch WITH PASSWORD mkdir -p /etc/fusionpbx chown -R freeswitch:daemon /etc/fusionpbx cp fusionpbx/config.php /etc/fusionpbx +sed -i /etc/fusionpbx/config.php -e s:"{database_host}:$database_host:" sed -i /etc/fusionpbx/config.php -e s:'{database_username}:fusionpbx:' sed -i /etc/fusionpbx/config.php -e s:"{database_password}:$database_password:" diff --git a/centos/resources/fusionpbx/config.php b/centos/resources/fusionpbx/config.php index 22776fb..1c187dc 100755 --- a/centos/resources/fusionpbx/config.php +++ b/centos/resources/fusionpbx/config.php @@ -32,7 +32,7 @@ //$db_path = '/var/www/fusionpbx/secure'; //the path is determined by a php variable //pgsql: database connection information - $db_host = 'localhost'; //set the host only if the database is not local + $db_host = '{database_host}'; $db_port = '5432'; $db_name = 'fusionpbx'; $db_username = '{database_username}'; diff --git a/debian/resources/finish.sh b/debian/resources/finish.sh index 302bf87..cfa99ec 100755 --- a/debian/resources/finish.sh +++ b/debian/resources/finish.sh @@ -34,6 +34,7 @@ sed -i "s/zzz/$database_password/g" /etc/cron.daily/fusionpbx-maintenance mkdir -p /etc/fusionpbx chown -R www-data:www-data /etc/fusionpbx cp fusionpbx/config.php /etc/fusionpbx +sed -i /etc/fusionpbx/config.php -e s:"{database_host}:$database_host:" sed -i /etc/fusionpbx/config.php -e s:'{database_username}:fusionpbx:' sed -i /etc/fusionpbx/config.php -e s:"{database_password}:$database_password:" diff --git a/debian/resources/fusionpbx/config.php b/debian/resources/fusionpbx/config.php index 22776fb..1c187dc 100755 --- a/debian/resources/fusionpbx/config.php +++ b/debian/resources/fusionpbx/config.php @@ -32,7 +32,7 @@ //$db_path = '/var/www/fusionpbx/secure'; //the path is determined by a php variable //pgsql: database connection information - $db_host = 'localhost'; //set the host only if the database is not local + $db_host = '{database_host}'; $db_port = '5432'; $db_name = 'fusionpbx'; $db_username = '{database_username}'; diff --git a/devuan/resources/finish.sh b/devuan/resources/finish.sh index 1acd0ce..8468302 100755 --- a/devuan/resources/finish.sh +++ b/devuan/resources/finish.sh @@ -69,6 +69,7 @@ cd $cwd mkdir -p /etc/fusionpbx chown -R www-data:www-data /etc/fusionpbx cp fusionpbx/config.php /etc/fusionpbx +sed -i /etc/fusionpbx/config.php -e s:"{database_host}:$database_host:" sed -i /etc/fusionpbx/config.php -e s:'{database_username}:fusionpbx:' sed -i /etc/fusionpbx/config.php -e s:"{database_password}:$database_password:" diff --git a/devuan/resources/fusionpbx/config.php b/devuan/resources/fusionpbx/config.php index 22776fb..1c187dc 100755 --- a/devuan/resources/fusionpbx/config.php +++ b/devuan/resources/fusionpbx/config.php @@ -32,7 +32,7 @@ //$db_path = '/var/www/fusionpbx/secure'; //the path is determined by a php variable //pgsql: database connection information - $db_host = 'localhost'; //set the host only if the database is not local + $db_host = '{database_host}'; $db_port = '5432'; $db_name = 'fusionpbx'; $db_username = '{database_username}'; diff --git a/freebsd/resources/finish.sh b/freebsd/resources/finish.sh index d40a68b..a3c6726 100755 --- a/freebsd/resources/finish.sh +++ b/freebsd/resources/finish.sh @@ -32,6 +32,7 @@ if [ .$nginx_enabled = .'true' ]; then mkdir -p /etc/fusionpbx chown -R www:www /etc/fusionpbx cp fusionpbx/config.php /etc/fusionpbx + sed -i' ' -e s:"{database_host}:$database_host:" /etc/fusionpbx/config.php sed -i' ' -e s:'{database_username}:fusionpbx:' /etc/fusionpbx/config.php sed -i' ' -e s:"{database_password}:$database_password:" /etc/fusionpbx/config.php diff --git a/freebsd/resources/fusionpbx/config.php b/freebsd/resources/fusionpbx/config.php index 22776fb..1c187dc 100755 --- a/freebsd/resources/fusionpbx/config.php +++ b/freebsd/resources/fusionpbx/config.php @@ -32,7 +32,7 @@ //$db_path = '/var/www/fusionpbx/secure'; //the path is determined by a php variable //pgsql: database connection information - $db_host = 'localhost'; //set the host only if the database is not local + $db_host = '{database_host}'; $db_port = '5432'; $db_name = 'fusionpbx'; $db_username = '{database_username}'; diff --git a/ubuntu/resources/finish.sh b/ubuntu/resources/finish.sh index 302bf87..cfa99ec 100755 --- a/ubuntu/resources/finish.sh +++ b/ubuntu/resources/finish.sh @@ -34,6 +34,7 @@ sed -i "s/zzz/$database_password/g" /etc/cron.daily/fusionpbx-maintenance mkdir -p /etc/fusionpbx chown -R www-data:www-data /etc/fusionpbx cp fusionpbx/config.php /etc/fusionpbx +sed -i /etc/fusionpbx/config.php -e s:"{database_host}:$database_host:" sed -i /etc/fusionpbx/config.php -e s:'{database_username}:fusionpbx:' sed -i /etc/fusionpbx/config.php -e s:"{database_password}:$database_password:" diff --git a/ubuntu/resources/fusionpbx/config.php b/ubuntu/resources/fusionpbx/config.php index 22776fb..1c187dc 100755 --- a/ubuntu/resources/fusionpbx/config.php +++ b/ubuntu/resources/fusionpbx/config.php @@ -32,7 +32,7 @@ //$db_path = '/var/www/fusionpbx/secure'; //the path is determined by a php variable //pgsql: database connection information - $db_host = 'localhost'; //set the host only if the database is not local + $db_host = '{database_host}'; $db_port = '5432'; $db_name = 'fusionpbx'; $db_username = '{database_username}';