Skip to content

Commit

Permalink
Update config to new parameters (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dahlgren authored Sep 12, 2023
1 parent bb3ec3d commit 4a8502a
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 39 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/ghcr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,12 @@ jobs:
- name: Load Image
run: docker load < image.tar.gz
- name: Run Image
run: docker run -d -p 17777:17777/udp arma-reforger
run: >
docker run -d
-e SERVER_A2S_ADDRESS=0.0.0.0
-e SERVER_A2S_PORT=17777
-p 17777:17777/udp
arma-reforger
- name: Install python dependencies
run: python3 -m pip install python-a2s
- name: Run Test
Expand Down
16 changes: 8 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,18 @@ ENV ARMA_BINARY="./ArmaReforgerServer"
ENV ARMA_PARAMS=""
ENV ARMA_MAX_FPS=120

ENV SERVER_REGION="EU"
ENV SERVER_ID=""
ENV SERVER_ADMIN_PASSWORD=""
ENV SERVER_HOST_BIND_ADDRESS="0.0.0.0"
ENV SERVER_HOST_BIND_PORT=2001
ENV SERVER_HOST_REGISTER_ADDRESS=""
ENV SERVER_HOST_REGISTER_PORT=2001
ENV SERVER_BIND_ADDRESS="0.0.0.0"
ENV SERVER_BIND_PORT=2001
ENV SERVER_PUBLIC_ADDRESS=""
ENV SERVER_PUBLIC_PORT=2001
ENV SERVER_A2S_ADDRESS=""
ENV SERVER_A2S_PORT=""

ENV GAME_NAME="Arma Reforger Docker Server"
ENV GAME_PASSWORD=""
ENV GAME_PASSWORD_ADMIN=""
ENV GAME_SCENARIO_ID="{ECC61978EDCC2B5A}Missions/23_Campaign.conf"
ENV GAME_PLAYER_LIMIT=32
ENV GAME_MAX_PLAYERS=32
ENV GAME_AUTO_JOINABLE=false
ENV GAME_VISIBLE=true
ENV GAME_SUPPORTED_PLATFORMS=PLATFORM_PC,PLATFORM_XBL
Expand Down
16 changes: 7 additions & 9 deletions docker_default.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
{
"dedicatedServerId": "",
"region": "EU",
"adminPassword": "",
"gameHostBindAddress": "",
"gameHostBindPort": 2001,
"gameHostRegisterBindAddress": "",
"gameHostRegisterPort": 2001,
"a2sQueryEnabled": true,
"bindAddress": "",
"bindPort": 2001,
"publicAddress": "",
"publicPort": 2001,
"a2s": null,
"game": {
"name": "Arma Reforger Docker Server",
"password": "",
"passwordAdmin": "",
"scenarioId": "{ECC61978EDCC2B5A}Missions/23_Campaign.conf",
"playerCountLimit": 32,
"maxPlayers": 32,
"autoJoinable": false,
"visible": true,
"supportedPlatforms": [
Expand Down
43 changes: 22 additions & 21 deletions launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,35 +52,36 @@ def bool_str(text):
config = json.load(f)
f.close()

if env_defined("SERVER_REGION"):
config["region"] = os.environ["SERVER_REGION"]
if env_defined("SERVER_ID"):
config["dedicatedServerId"] = os.environ["SERVER_ID"]
if env_defined("SERVER_ADMIN_PASSWORD"):
config["adminPassword"] = os.environ["SERVER_ADMIN_PASSWORD"]
if env_defined("SERVER_BIND_ADDRESS"):
config["bindAddress"] = os.environ["SERVER_BIND_ADDRESS"]
if env_defined("SERVER_BIND_PORT"):
config["bindPort"] = int(os.environ["SERVER_BIND_PORT"])
if env_defined("SERVER_PUBLIC_ADDRESS"):
config["publicAddress"] = os.environ["SERVER_PUBLIC_ADDRESS"]
if env_defined("SERVER_PUBLIC_PORT"):
config["publicPort"] = int(os.environ["SERVER_PUBLIC_PORT"])
if env_defined("SERVER_A2S_ADDRESS") and env_defined("SERVER_A2S_PORT"):
config["a2s"] = {
"address": os.environ["SERVER_A2S_ADDRESS"],
"port": int(os.environ["SERVER_A2S_PORT"]),
}
else:
adminPassword = random_passphrase()
config["adminPassword"] = adminPassword
print(f"Admin password: {adminPassword}")
if env_defined("SERVER_HOST_BIND_ADDRESS"):
config["gameHostBindAddress"] = os.environ["SERVER_HOST_BIND_ADDRESS"]
if env_defined("SERVER_HOST_BIND_PORT"):
config["gameHostBindPort"] = int(os.environ["SERVER_HOST_BIND_PORT"])
if env_defined("SERVER_HOST_REGISTER_ADDRESS"):
config["gameHostRegisterBindAddress"] = os.environ[
"SERVER_HOST_REGISTER_ADDRESS"
]
if env_defined("SERVER_HOST_REGISTER_PORT"):
config["gameHostRegisterPort"] = int(os.environ["SERVER_HOST_REGISTER_PORT"])
config["a2s"] = None

if env_defined("GAME_NAME"):
config["game"]["name"] = os.environ["GAME_NAME"]
if env_defined("GAME_PASSWORD"):
config["game"]["password"] = os.environ["GAME_PASSWORD"]
if env_defined("GAME_PASSWORD_ADMIN"):
config["game"]["passwordAdmin"] = os.environ["GAME_PASSWORD_ADMIN"]
else:
adminPassword = random_passphrase()
config["game"]["passwordAdmin"] = adminPassword
print(f"Admin password: {adminPassword}")
if env_defined("GAME_SCENARIO_ID"):
config["game"]["scenarioId"] = os.environ["GAME_SCENARIO_ID"]
if env_defined("GAME_PLAYER_LIMIT"):
config["game"]["playerCountLimit"] = int(os.environ["GAME_PLAYER_LIMIT"])
if env_defined("GAME_MAX_PLAYERS"):
config["game"]["maxPlayers"] = int(os.environ["GAME_MAX_PLAYERS"])
if env_defined("GAME_AUTO_JOINABLE"):
config["game"]["autoJoinable"] = bool_str(os.environ["GAME_AUTO_JOINABLE"])
if env_defined("GAME_VISIBLE"):
Expand Down

0 comments on commit 4a8502a

Please sign in to comment.