mirror of
https://gitlab.bmcstudios.org/public_projects/swg-server-docker.git
synced 2026-01-16 17:04:26 -05:00
57 lines
1.6 KiB
Bash
57 lines
1.6 KiB
Bash
#!/bin/sh
|
|
# entrypoint.sh
|
|
|
|
# Get the container's own IP address at runtime
|
|
CONTAINER_IP=$(hostname -i)
|
|
|
|
# Define the path to the configuration file
|
|
CONFIG_FILE="/swg-main/exe/linux/servercommon.cfg"
|
|
|
|
# Define unique markers for the beginning and end of our configuration block
|
|
START_MARKER="# BEGIN DOCKER-MANAGED CONFIG"
|
|
END_MARKER="# END DOCKER-MANAGED CONFIG"
|
|
|
|
# 1. Remove the entire block from the start marker to the end marker.
|
|
# The -i flag modifies the file in-place.
|
|
# On the first run, this command will do nothing if the markers don't exist, which is fine.
|
|
sed -i "/${START_MARKER}/,/${END_MARKER}/d" ${CONFIG_FILE}
|
|
|
|
# 2. Now, append the new, updated configuration block, including the markers.
|
|
cat <<EOF >> ${CONFIG_FILE}
|
|
|
|
${START_MARKER}
|
|
# This block is automatically managed by the container's entrypoint script.
|
|
# Do not edit it manually, as changes will be overwritten on container restart.
|
|
[dbProcess]
|
|
DSN=DBSERVICE
|
|
databaseUID=DBUSERNAME
|
|
centralServerAddress=${CONTAINER_IP}
|
|
|
|
[LoginServer]
|
|
DSN=DBSERVICE
|
|
databaseUID=DBUSERNAME
|
|
developmentMode=true
|
|
useExternalAuth=true
|
|
|
|
[CentralServer]
|
|
developmentMode=true
|
|
|
|
[ChatServer]
|
|
centralServerAddress=${CONTAINER_IP}
|
|
|
|
[GameServer]
|
|
centralServerAddress=${CONTAINER_IP}
|
|
adminGodToAll=1
|
|
adminGodToAllGodLevel=50
|
|
debugMode=1
|
|
|
|
[TaskManager]
|
|
loginServerAddress=${CONTAINER_IP}
|
|
node0=${CONTAINER_IP}
|
|
environmentVariable=PATH+=/usr/lib/jvm/java-11-openjdk-i386/bin:./
|
|
environmentVariable=LD_LIBRARY_PATH+=/usr/lib/jvm/java-11-openjdk-i386/lib:/usr/lib/jvm/java-11-openjdk-i386/lib/server:./
|
|
${END_MARKER}
|
|
EOF
|
|
|
|
# This command executes the original CMD from the Dockerfile
|
|
exec "$@" |