Added passeneg manager. Part 9

devel
Alexey Berezhok 4 months ago
parent 0ecf0ee925
commit c0efc35d34

@ -283,22 +283,19 @@ add_web_config() {
fi fi
PASS_TPL="" PASS_TPL=""
#Passenger generator if [[ "$TPLNM" =~ ^passenger ]]; then
if [ -e /usr/local/hestia/bin/v-ext-modules ]; then #Passenger generator
res=$(/usr/local/hestia/bin/v-ext-modules state passenger_manager csv | tail -n 1 | /usr/bin/xargs | cut -d"," -f6 ) if [ -e /usr/local/hestia/bin/v-ext-modules ]; then
if [ -n "$res" ]; then res=$(/usr/local/hestia/bin/v-ext-modules state passenger_manager csv | tail -n 1 | /usr/bin/xargs | cut -d"," -f6 )
enabled=$(echo "$res" | grep enabled) if [ -n "$res" ]; then
if [ -n "$enabled" ]; then enabled=$(echo "$res" | grep enabled)
RUBY_RES=$(/usr/local/hestia/bin/v-ext-modules-run passenger_manager get_user_ruby "$domain" | tail -n1 | /usr/bin/xargs) if [ -n "$enabled" ]; then
if [ -n "$RUBY_RES" ]; then RUBY_RES=$(/usr/local/hestia/bin/v-ext-modules-run passenger_manager get_user_ruby "$domain" | tail -n1 | /usr/bin/xargs)
pass_tpl_dir=$(/usr/local/hestia/bin/v-ext-modules-run passenger_manager get_tpl_path | tail -n1 | /usr/bin/xargs) if [ -n "$RUBY_RES" ]; then
if [ -n "$pass_tpl_dir" ]; then pass_tpl_dir=$(/usr/local/hestia/bin/v-ext-modules-run passenger_manager get_tpl_path | tail -n1 | /usr/bin/xargs)
pass_tpl_dir=${pass_tpl_dir%/} if [ -n "$pass_tpl_dir" ]; then
PASS_TPL="$pass_tpl_dir" pass_tpl_dir=${pass_tpl_dir%/}
if [[ "$TPLNM" =~ stpl$ ]]; then PASS_TPL="$pass_tpl_dir"
TPLNM="passenger.stpl"
else
TPLNM="passenger.tpl"
fi fi
fi fi
fi fi
@ -306,10 +303,6 @@ add_web_config() {
fi fi
fi fi
if [ "$1" == "httpd" -a -n "$PASS_TPL" ]; then
return
fi
conf="$HOMEDIR/$user/conf/web/$domain/$1.conf" conf="$HOMEDIR/$user/conf/web/$domain/$1.conf"
if [[ "$TPLNM" =~ stpl$ ]]; then if [[ "$TPLNM" =~ stpl$ ]]; then
conf="$HOMEDIR/$user/conf/web/$domain/$1.ssl.conf" conf="$HOMEDIR/$user/conf/web/$domain/$1.ssl.conf"
@ -325,7 +318,8 @@ add_web_config() {
WEBTPL_LOCATION="$WEBTPL/$1/$WEB_BACKEND" WEBTPL_LOCATION="$WEBTPL/$1/$WEB_BACKEND"
fi fi
fi fi
if [ -n "$PASS_TPL" ]; then
if [[ "$TPLNM" =~ ^passenger ]] && [ -n "$PASS_TPL" ]; then
WEBTPL_LOCATION="$PASS_TPL" WEBTPL_LOCATION="$PASS_TPL"
fi fi
@ -371,6 +365,13 @@ add_web_config() {
mv -f ${conf}.tmp $conf mv -f ${conf}.tmp $conf
fi 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" process_http2_directive "$conf"
chown root:$user $conf chown root:$user $conf

Loading…
Cancel
Save