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

Move parameter variables to configs

Setting variables in configs is preferred.
Marvin Lehmann 9 лет назад
Родитель
Сommit
9823aed3df
2 измененных файлов с 21 добавлено и 8 удалено
  1. 2 8
      DontStarveTogether/dstserver
  2. 19 0
      lgsm/functions/info_config.sh

+ 2 - 8
DontStarveTogether/dstserver

@@ -29,19 +29,13 @@ shard="Master"
 cluster="Cluster_1"
 cave="false"
 
-## Server Start Settings | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters
-ip="0.0.0.0"
-port="11000"
-steamauthenticationport="8768"
-steammasterserverport="27018"
-
 # Edit with care
 persistentstorageroot="${HOME}/.klei"
 confdir="DoNotStarveTogether"
 
 ## Server Start Command | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters#additional-parameters
 fn_parms(){
-parms="-bind_ip ${ip} -port ${port} -steam_master_server_port ${steammasterserverport} -steam_authentication_port ${steamauthenticationport} -persistent_storage_root ${persistentstorageroot} -conf_dir ${confdir} -cluster ${cluster} -shard ${shard}"
+parms="-persistent_storage_root ${persistentstorageroot} -conf_dir ${confdir} -cluster ${cluster} -shard ${shard}"
 }
 
 #### LinuxGSM Settings ####
@@ -91,7 +85,7 @@ gamename="Don't Starve Together"
 engine="dontstarve"
 
 ## Service Name | https://github.com/GameServerManagers/LinuxGSM/wiki/Multiple-Servers
-servicename="dst-server"
+servicename="dst-server-${shard}"
 
 #### Directories ####
 # Edit with care

+ 19 - 0
lgsm/functions/info_config.sh

@@ -95,6 +95,10 @@ fn_info_config_dontstarve(){
 		gamemode=$(grep "game_mode" "${clustercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/game_mode//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
 		tickrate=$(grep "tick_rate" "${clustercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]')
 		masterport=$(grep "master_port" "${clustercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]')
+		
+		ip=$(grep "bind_ip" "${clustercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/bind_ip//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
+		ipsetinconfig=1
+		ipinconfigvar="bind_ip"
 
 		# Not Set
 		servername=${servername:-"NOT SET"}
@@ -104,6 +108,21 @@ fn_info_config_dontstarve(){
 		tickrate=${tickrate:-"0"}
 		masterport=${masterport:-"0"}
 	fi
+	
+	if [ ! -f "${servercfgfullpath}" ]; then
+		port="${zero}"
+		steamauthenticationport="${zero}"
+		steammasterserverport="${zero}"
+	else
+		port=$(grep "server_port" "${servercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]')
+		steamauthenticationport=$(grep "authentication_port" "${servercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]')
+		steammasterserverport=$(grep "master_server_port" "${servercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]')
+		
+		# Not Set
+		port=${port:-"0"}
+		steamauthenticationport=${steamauthenticationport:-"0"}
+		steammasterserverport=${steammasterserverport:-"0"}
+	fi
 }
 
 fn_info_config_minecraft(){