From c0efc35d34518532ece0c0bf70d55e5de7f28f7d Mon Sep 17 00:00:00 2001 From: Alexey Berezhok Date: Tue, 24 Dec 2024 22:52:19 +0300 Subject: [PATCH] Added passeneg manager. Part 9 --- func/domain.sh | 43 ++++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/func/domain.sh b/func/domain.sh index 3ce8a4c..d65210c 100644 --- a/func/domain.sh +++ b/func/domain.sh @@ -283,22 +283,19 @@ add_web_config() { fi PASS_TPL="" - #Passenger generator - if [ -e /usr/local/hestia/bin/v-ext-modules ]; then - res=$(/usr/local/hestia/bin/v-ext-modules state passenger_manager csv | tail -n 1 | /usr/bin/xargs | cut -d"," -f6 ) - if [ -n "$res" ]; then - enabled=$(echo "$res" | grep enabled) - if [ -n "$enabled" ]; then - RUBY_RES=$(/usr/local/hestia/bin/v-ext-modules-run passenger_manager get_user_ruby "$domain" | tail -n1 | /usr/bin/xargs) - if [ -n "$RUBY_RES" ]; then - pass_tpl_dir=$(/usr/local/hestia/bin/v-ext-modules-run passenger_manager get_tpl_path | tail -n1 | /usr/bin/xargs) - if [ -n "$pass_tpl_dir" ]; then - pass_tpl_dir=${pass_tpl_dir%/} - PASS_TPL="$pass_tpl_dir" - if [[ "$TPLNM" =~ stpl$ ]]; then - TPLNM="passenger.stpl" - else - TPLNM="passenger.tpl" + if [[ "$TPLNM" =~ ^passenger ]]; then + #Passenger generator + if [ -e /usr/local/hestia/bin/v-ext-modules ]; then + res=$(/usr/local/hestia/bin/v-ext-modules state passenger_manager csv | tail -n 1 | /usr/bin/xargs | cut -d"," -f6 ) + if [ -n "$res" ]; then + enabled=$(echo "$res" | grep enabled) + if [ -n "$enabled" ]; then + RUBY_RES=$(/usr/local/hestia/bin/v-ext-modules-run passenger_manager get_user_ruby "$domain" | tail -n1 | /usr/bin/xargs) + if [ -n "$RUBY_RES" ]; then + pass_tpl_dir=$(/usr/local/hestia/bin/v-ext-modules-run passenger_manager get_tpl_path | tail -n1 | /usr/bin/xargs) + if [ -n "$pass_tpl_dir" ]; then + pass_tpl_dir=${pass_tpl_dir%/} + PASS_TPL="$pass_tpl_dir" fi fi fi @@ -306,10 +303,6 @@ add_web_config() { fi fi - if [ "$1" == "httpd" -a -n "$PASS_TPL" ]; then - return - fi - conf="$HOMEDIR/$user/conf/web/$domain/$1.conf" if [[ "$TPLNM" =~ stpl$ ]]; then conf="$HOMEDIR/$user/conf/web/$domain/$1.ssl.conf" @@ -325,7 +318,8 @@ add_web_config() { WEBTPL_LOCATION="$WEBTPL/$1/$WEB_BACKEND" fi fi - if [ -n "$PASS_TPL" ]; then + + if [[ "$TPLNM" =~ ^passenger ]] && [ -n "$PASS_TPL" ]; then WEBTPL_LOCATION="$PASS_TPL" fi @@ -371,6 +365,13 @@ add_web_config() { mv -f ${conf}.tmp $conf fi + if [[ "$TPLNM" =~ ^passenger ]] && [ -n "$PASS_TPL" ]; then + cat "$conf" \ + | sed -e "s|%rubypath%|$RUBY_RES|g" \ + > $conf.tmp + mv -f ${conf}.tmp $conf + fi + process_http2_directive "$conf" chown root:$user $conf