Skip to content

Commit 7e02dda

Browse files
committed
Fallback to web template folder when tpl is missing from web_backend(php-fpm) folder
1 parent 18f8ad5 commit 7e02dda

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

func/domain.sh

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,15 @@ add_web_config() {
193193
domain_idn=$domain
194194
format_domain_idn
195195

196-
cat $WEBTPL/$1/$WEB_BACKEND/$2 | \
196+
WEBTPL_LOCATION="$WEBTPL/$1"
197+
if [ ! -z "$WEB_BACKEND" ] && [ -d "$WEBTPL_LOCATION/$WEB_BACKEND" ]; then
198+
if [ -f "$WEBTPL_LOCATION/$WEB_BACKEND/$2" ]; then
199+
# check for backend specific template
200+
WEBTPL_LOCATION="$WEBTPL/$1/$WEB_BACKEND"
201+
fi
202+
fi
203+
204+
cat "${WEBTPL_LOCATION}/$2" | \
197205
sed -e "s|%ip%|$local_ip|g" \
198206
-e "s|%domain%|$domain|g" \
199207
-e "s|%domain_idn%|$domain_idn|g" \
@@ -270,8 +278,8 @@ add_web_config() {
270278
fi
271279

272280
trigger="${2/.*pl/.sh}"
273-
if [ -x "$WEBTPL/$1/$WEB_BACKEND/$trigger" ]; then
274-
$WEBTPL/$1/$WEB_BACKEND/$trigger \
281+
if [ -x "${WEBTPL_LOCATION}/$trigger" ]; then
282+
$WEBTPL_LOCATION/$trigger \
275283
$user $domain $local_ip $HOMEDIR \
276284
$HOMEDIR/$user/web/$domain/public_html
277285
fi

0 commit comments

Comments
 (0)