mirror of
https://github.com/serghey-rodin/vesta.git
synced 2025-08-20 21:34:11 -07:00
Code refactoring: domain_idn + new restart routine
This commit is contained in:
parent
b98abaf572
commit
e5950d516d
104 changed files with 605 additions and 588 deletions
|
@ -18,37 +18,23 @@
|
|||
# Argument definition
|
||||
user=$1
|
||||
domain=$2
|
||||
domain_idn=$2
|
||||
ip=$3
|
||||
restart=$4 # will be moved to the end soon
|
||||
aliases=$5
|
||||
proxy_ext=$6
|
||||
|
||||
# Additional argument formatting
|
||||
if [[ "$domain" =~ [[:upper:]] ]]; then
|
||||
domain=$(echo "$domain" |tr '[:upper:]' '[:lower:]')
|
||||
fi
|
||||
if [[ "$domain" =~ ^www\..* ]]; then
|
||||
domain=$(echo "$domain" |sed -e "s/^www.//")
|
||||
fi
|
||||
if [[ "$domain" =~ .*\.$ ]]; then
|
||||
domain=$(echo "$domain" |sed -e "s/\.$//")
|
||||
fi
|
||||
domain_idn="$domain"
|
||||
if [[ "$domain" = *[![:ascii:]]* ]]; then
|
||||
domain_idn=$(idn -t --quiet -a $domain)
|
||||
fi
|
||||
if [ ! -z "$aliases" ] && [ "$aliases" != 'none' ]; then
|
||||
aliases=$(echo $aliases |tr '[:upper:]' '[:lower:]' |tr ',' '\n')
|
||||
aliases=$(echo "$aliases" |sed -e "s/\.$//" |sort -u |grep -v www.$domain)
|
||||
aliases=$(echo "$aliases" |sed -e "/^$/d" |tr '\n' ',' |sed -e "s/,$//")
|
||||
fi
|
||||
|
||||
# Includes
|
||||
source $VESTA/func/main.sh
|
||||
source $VESTA/func/domain.sh
|
||||
source $VESTA/func/ip.sh
|
||||
source $VESTA/conf/vesta.conf
|
||||
|
||||
# Additional argument formatting
|
||||
format_domain
|
||||
format_domain_idn
|
||||
format_aliases
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Verifications #
|
||||
|
@ -178,10 +164,8 @@ $BIN/v-restart-web $restart
|
|||
check_result $? "Web restart failed" >/dev/null
|
||||
|
||||
# Restarting proxy server
|
||||
if [ ! -z "$PROXY_SYSTEM" ]; then
|
||||
$BIN/v-restart-proxy $restart
|
||||
check_result $? "Proxy restart failed" >/dev/null
|
||||
fi
|
||||
$BIN/v-restart-proxy $restart
|
||||
check_result $? "Proxy restart failed" >/dev/null
|
||||
|
||||
# Logging
|
||||
log_history "added web domain $domain"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue