From ea1f9efef595713d6c404213c47b83e74e23598e Mon Sep 17 00:00:00 2001 From: Asif Bacchus Date: Sat, 5 Jan 2019 18:31:44 -0700 Subject: [PATCH] updated subst php tags for .insert files --- .vscode/numbered-bookmarks.json | 6 +++--- setup.sh | 12 +++++++++++- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/.vscode/numbered-bookmarks.json b/.vscode/numbered-bookmarks.json index 8b519b5..faf81f5 100644 --- a/.vscode/numbered-bookmarks.json +++ b/.vscode/numbered-bookmarks.json @@ -5,14 +5,14 @@ "bookmarks": [ -1, 30, - 42, + 43, -1, -1, -1, -1, -1, - 626, - 538 + 636, + 625 ] } ] diff --git a/setup.sh b/setup.sh index ee7683e..3bce99a 100644 --- a/setup.sh +++ b/setup.sh @@ -58,6 +58,9 @@ tag_phphandler="#$" file_phphandler="nginx/nginx.conf" file_phpTCP="nginx/nginx_conf_phphandler_TCP.insert" file_phpSOCK="nginx/nginx_conf_phphandler_SOCK.insert" +tag_phpAddr="" +tag_phpPort="" +tag_phpVersion="" ### quick intro for the user echo -e "\n${mag}This script will customize the provided NGINX template files for your" @@ -610,16 +613,23 @@ if [ "${usePHP}" -eq 1 ]; then cat "${configPath}/${file_buffersPHP}" >> "${configPath}/${file_buffers}" fi -# if using PHP-TCP: add upstream handler in nginx.conf +## if using PHP-TCP: add upstream handler in nginx.conf if [ "${phpType}" = "tcp" ]; then echo "updating ${warn}${configPath}/${file_phphandler}${norm}" + # copy .insert file into nginx.conf sed -i -e "/${tag_phphandler}/{r ${configPath}/${file_phpTCP}" -e 'd}' "${configPath}/${file_phphandler}" + # update tags with address and port information + sed -i "s/${tag_phpAddr}/${phpAddr}" "${configPath}/${file_phpTCP}" + sed -i "s/${tag_phpPort}/${phpPort}" "${configPath}/${file_phpTCP}" fi # if using PHP-SOCK: add upstream handler in nginx.conf if [ "${phpType}" = "sockets" ]; then echo "updating ${warn}${configPath}/${file_phphandler}${norm}" + # copy .insert file into nginx.conf sed -i -e "/${tag_phphandler}/{r ${configPath}/${file_phpSOCK}" -e 'd}' "${configPath}/${file_phphandler}" + # update tag with version number + sed -i "s/${tag_phpVersion}/${phpVersion}" "${configPath}/${file_phpSOCK}" fi