Add possibility to change game name and password

This commit is contained in:
mr-vercetti 2022-03-27 19:34:05 +02:00
parent 9592e6cedd
commit a163438cbf
2 changed files with 20 additions and 2 deletions

View File

@ -14,7 +14,10 @@ ENV LANG=en_US.UTF-8 LANGUAGE=en_US.UTF-8
ENV APP_DIR="/app"
ENV STEAMCMD_DIR="${APP_DIR}/Steam/steamcmd"
ENV SERVER_DIR="${APP_DIR}/server"
# Startup variables
ENV GAME_PARAMS="-num_edicts 3072 +sv_lan 1 -port 27015 -console -debug;"
ENV GAME_NAME=""
ENV GAME_PASSWORD=""
# Set up user environment
RUN groupadd -r abc && \

View File

@ -1,5 +1,20 @@
#!/bin/bash
echo "Starting Sven Co-Op server..."
server_cfg_file="$SERVER_DIR/svencoop/server.cfg"
liblist_file="$SERVER_DIR/svencoop/liblist.gam"
if [[ $GAME_NAME != "" ]]; then
echo "Starting Sven Co-Op server \"$GAME_NAME\""
sed -i "s/\/\?\/\?hostname \".*\"/hostname \"$GAME_NAME\"/" $server_cfg_file
sed -i "s/\/\?\/\?game \".*\"/game \"$GAME_NAME\"/" $liblist_file
else
echo "Starting Sven Co-Op server"
fi
if [[ $GAME_PASSWORD != "" ]]; then
echo "Password protection enabled"
sed -i "s/\/\?\/\?sv_password \".*\"/sv_password \"$GAME_PASSWORD\"/" $server_cfg_file
fi
cd ${SERVER_DIR}
${SERVER_DIR}/svends_run ${GAME_PARAMS}
${SERVER_DIR}/svends_run ${GAME_PARAMS}