Просмотр исходного кода

Merge pull request #1712 from jaapmarcus/fix/1710-fix-unwantend-port-reset

Use port number hestia-nginx port number instead the default one.
Kristan Kenney 5 лет назад
Родитель
Сommit
e07608d4f3
2 измененных файлов с 5 добавлено и 12 удалено
  1. 2 10
      bin/v-change-sys-port
  2. 3 2
      func/syshealth.sh

+ 2 - 10
bin/v-change-sys-port

@@ -58,16 +58,8 @@ check_hestia_demo_mode
 # Get original port
 ORIGINAL_PORT=$(cat $HESTIA/nginx/conf/nginx.conf | grep "listen" | sed 's/[^0-9]*//g')
 
-# Check if system variable is set
-if [ ! -n "$BACKEND_PORT" ]; then
-    echo "BACKEND_PORT='$port'" >> $HESTIA/conf/hestia.conf
-    source $HESTIA/conf/hestia.conf
-fi
-
-# Check if port is different to hestia.conf
-if [ ! "$BACKEND_PORT" = "$PORT" ]; then
-    sed -i s/BACKEND_PORT=\'$BACKEND_PORT\'/BACKEND_PORT=\'$PORT\'/g $HESTIA/conf/hestia.conf
-fi
+# Set new port in config via v-change-sys-config-value
+$HESTIA/bin/v-change-sys-config-value "BACKEND_PORT" $PORT
 
 # Check if port is different to nginx.conf
 if [ "$ORIGINAL_PORT" = "$PORT" ]; then

+ 3 - 2
func/syshealth.sh

@@ -236,8 +236,9 @@ function syshealth_repair_system_config() {
 
     # Backend port
     if [ -z "$BACKEND_PORT" ]; then 
-        echo "[ ! ] Adding missing variable to hestia.conf: BACKEND_PORT ('8083')"
-        $BIN/v-change-sys-port '8083' >/dev/null 2>&1
+        ORIGINAL_PORT=$(cat $HESTIA/nginx/conf/nginx.conf | grep "listen" | sed 's/[^0-9]*//g')
+        echo "[ ! ] Adding missing variable to hestia.conf: BACKEND_PORT ('$ORIGINAL_PORT')"
+        $HESTIA/bin/v-change-sys-config-value 'BACKEND_PORT' $PORT
     fi
 
     # Upgrade: Send email notification