Skip to content

Commit

Permalink
Feature: Changeable port
Browse files Browse the repository at this point in the history
  • Loading branch information
PassiveLemon committed Aug 20, 2024
1 parent da47286 commit a7ac229
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ ENV MODPACK=""
ENV MOTD=""
ENV NPCSTREAM="15"
ENV PASSWORD=""
ENV PORT="7777"
ENV PRIORITY="1"
ENV SECURE="1"
ENV SEED=""
Expand All @@ -51,5 +52,5 @@ ENV WORLDNAME="World"

ENTRYPOINT ["/opt/terraria/entrypoint.sh"]

HEALTHCHECK --interval=15s --timeout=5s --start-period=10s --retries=3 CMD nc -vz 127.0.0.1 7777 || exit 1
HEALTHCHECK --interval=15s --timeout=5s --start-period=10s --retries=3 CMD nc -vz 127.0.0.1 $PORT || exit 1

3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ MAXPLAYERS | `integer` | `8`
MOTD | `string` | `NA`
NPCSTREAM | `integer 0-60` | `15`
PASSWORD | `string` | `NA`
PORT | `integer` | `7777`
PRIORITY | `0` `1` `2` `3` `4` `5` | `1`
SECURE | `boolean` | `1`
SEED | `string` | `NA`
UPNP | `boolean` | `0`
WORLDNAME | `string` | `World`
- Note: The internal port is not changeable.

Journey mode variables are not supported in the Dockerfile variable statements. Those will need to be manually put in the server config. </br>

Expand Down Expand Up @@ -164,3 +164,4 @@ Have fun! </br>

# Credits
[rfvgyhn](https://github.com/rfvgyhn/tmodloader-docker) for the server injection functionality.

4 changes: 3 additions & 1 deletion scripts/variables.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ VAR_ARRAY[NPCSTREAMx]="npcstream=${NPCSTREAM}"
if [ "$PASSWORD" != "" ]; then
VAR_ARRAY[PASSWORDx]="password=${PASSWORD}"
fi
VAR_ARRAY[PORTx]="port=7777"
if [ "$PORT" != "" ]; then
VAR_ARRAY[PORTx]="port=${PORT}"
fi
VAR_ARRAY[PRIORITYx]="priority=${PRIORITY}"
VAR_ARRAY[SECUREx]="secure=${SECURE}"
if [ "$SEED" != "" ]; then
Expand Down

0 comments on commit a7ac229

Please sign in to comment.