moved web/proxy port values to global config

This commit is contained in:
Serghey Rodin 2011-06-26 14:16:59 +03:00
commit e11a13c16c
7 changed files with 29 additions and 37 deletions

View file

@ -219,37 +219,6 @@ sort_dns_records() {
mv -f $conf.tmp $conf
}
get_web_port() {
proxy_disabled='80'
proxy_enabled='8080'
# Parsing conf
proxy=$(grep 'PROXY_SYSTEM=' $V_CONF/vesta.conf|cut -f 2 -d \')
# Checking result
if [ -z "$proxy" ] || [ "$proxy" = 'off' ]; then
echo "$proxy_disabled"
else
echo "$proxy_enabled"
fi
}
get_web_port_ssl() {
proxy_disabled='443'
proxy_enabled='8443'
# Parsing conf
proxy=$(grep 'PROXY_SYSTEM=' $V_CONF/vesta.conf|cut -f 2 -d \')
# Checking result
if [ -z "$proxy" ] || [ "$proxy" = 'off' ]; then
echo "$proxy_disabled"
else
echo "$proxy_enabled"
fi
}
httpd_add_config() {
# Adding template to config
cat $tpl_file | \
@ -266,6 +235,7 @@ httpd_add_config() {
-e "s/%alias%/${aliases//,/ }/g" \
-e "s/%ssl_cert%/${ssl_cert////\/}/g" \
-e "s/%ssl_key%/${ssl_key////\/}/g" \
-e "s/%extentions%/$extentions/g" \
>> $conf
}

View file

@ -592,7 +592,7 @@ is_template_valid() {
proxy_template() {
tpl="$V_WEBTPL/ngingx_vhost_$template.tpl"
descr="$V_WEBTPL/ngingx_vhost_$template.descr"
ssl="$V_WEBTPL/ngingx_vhost_$template.ssl.tpl"
ssl="$V_WEBTPL/ngingx_vhost_$template.stpl"
if [ ! -e $tpl ] || [ ! -e $descr ] || [ ! -e $ssl ]; then
echo "Error: template not found"
@ -1334,3 +1334,20 @@ pkg_shell_list() {
i=$(($i + 1))
done
}
get_config_value() {
key="$1"
# Parsing config
string=$(cat $V_CONF/vesta.conf)
# Parsing key=value
for keys in $string; do
eval ${keys%%=*}=${keys#*=}
done
# Self reference
eval value="$key"
# Print value
echo "$value"
}