Browse Source

fix(fctrserver): fix and improve fetching info from config file (#3031)

pull/3033/head
Christian 5 years ago
committed by GitHub
parent
commit
37fda0ff7e
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 17
      lgsm/functions/info_config.sh
  2. 15
      lgsm/functions/info_messages.sh

17
lgsm/functions/info_config.sh

@ -377,15 +377,24 @@ fn_info_config_factorio(){
servername="Factorio Server"
serverpassword="${unavailable}"
maxplayers="${zero}"
authtoken=${authtoken:-"NOT SET"}
savegameinterval="${unavailable}"
versioncount="${unavailable}"
else
servername="Factorio Server"
serverpassword=$(grep "game_password" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/game_password//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
maxplayers=$(grep "\"max_players\"" "${servercfgfullpath}" | tr -cd '[:digit:]')
servername=$(jq -r '.name' "${servercfgfullpath}")
serverpassword=$(jq -r '.game_password' "${servercfgfullpath}")
maxplayers=$(jq -r '.max_players' "${servercfgfullpath}")
authtoken=$(jq -r '.token' "${servercfgfullpath}")
savegameinterval=$(jq -r '.autosave_interval' "${servercfgfullpath}")
versioncount=$(jq -r '.autosave_slots' "${servercfgfullpath}")
# Not Set
servername=${servername:-"NOT SET"}
serverpassword=${serverpassword:-"NOT SET"}
maxplayers=${maxplayers=:-"0"}
maxplayers=${maxplayers:-"0"}
authtoken=${authtoken:-"NOT SET"}
savegameinterval=${savegameinterval:-"0"}
versioncount=${versioncount:-"0"}
fi
}

15
lgsm/functions/info_messages.sh

@ -382,6 +382,21 @@ fn_info_message_gameserver(){
echo -e "${lightblue}Server Version:\t${default}${serverversion}"
fi
# authentication token (Factorio)
if [ -n "${authtoken}" ]; then
echo -e "${lightblue}Auth Token:\t${default}${authtoken}"
fi
# savegameinterval (Factorio)
if [ -n "${savegameinterval}" ]; then
echo -e "${lightblue}Savegame Interval:\t${default}${savegameinterval}"
fi
# versioncount (Factorio)
if [ -n "${versioncount}" ]; then
echo -e "${lightblue}Version Count:\t${default}${versioncount}"
fi
# Listed on Master server
if [ -n "${displaymasterserver}" ]; then
if [ "${displaymasterserver}" == "true" ]; then

Loading…
Cancel
Save