From d3e80917285e5c862b8cbe0fe97aa802f0cc8196 Mon Sep 17 00:00:00 2001 From: Simon <37269807+sdsznsk@users.noreply.github.com> Date: Wed, 22 Nov 2023 03:36:19 +0100 Subject: [PATCH 1/3] Add support for admins config property, switch default compose image tag to latest --- Dockerfile | 2 ++ docker-compose.yml | 2 +- docker_default.json | 1 + launch.py | 6 ++++++ 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 4fc816f..4b3ee3f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -52,6 +52,8 @@ ENV SERVER_A2S_PORT="" ENV GAME_NAME="Arma Reforger Docker Server" ENV GAME_PASSWORD="" ENV GAME_PASSWORD_ADMIN="" +# GAME_ADMINS - comma-delimited list of identityIds and/or steamIds +ENV GAME_ADMINS="" ENV GAME_SCENARIO_ID="{ECC61978EDCC2B5A}Missions/23_Campaign.conf" ENV GAME_MAX_PLAYERS=32 ENV GAME_VISIBLE=true diff --git a/docker-compose.yml b/docker-compose.yml index ada8203..d0a81fd 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,7 +2,7 @@ version: '3.8' services: arma-reforger: - image: ghcr.io/acemod/arma-reforger:edge + image: ghcr.io/acemod/arma-reforger:latest platform: linux/amd64 container_name: arma-reforger ports: diff --git a/docker_default.json b/docker_default.json index dd8694e..ba7c9bf 100644 --- a/docker_default.json +++ b/docker_default.json @@ -8,6 +8,7 @@ "name": "Arma Reforger Docker Server", "password": "", "passwordAdmin": "", + "admins": [], "scenarioId": "{ECC61978EDCC2B5A}Missions/23_Campaign.conf", "maxPlayers": 32, "visible": true, diff --git a/launch.py b/launch.py index 052b661..469afd4 100644 --- a/launch.py +++ b/launch.py @@ -79,6 +79,12 @@ def bool_str(text): adminPassword = random_passphrase() config["game"]["passwordAdmin"] = adminPassword print(f"Admin password: {adminPassword}") + if env_defined("GAME_ADMINS"): + config["game"]["admins"] = [] + admins = str(os.environ["GAME_ADMINS"]).split(",") + admins[:] = [admin for admin in admins if admin] # Remove empty items form list + for admin in admins: + config["game"]["admins"].append(admin) if env_defined("GAME_SCENARIO_ID"): config["game"]["scenarioId"] = os.environ["GAME_SCENARIO_ID"] if env_defined("GAME_MAX_PLAYERS"): From d791de36aa493a55d9780bb27ec729568ae4842a Mon Sep 17 00:00:00 2001 From: Simon <37269807+sdsznsk@users.noreply.github.com> Date: Thu, 23 Nov 2023 23:12:48 +0100 Subject: [PATCH 2/3] Remove unnecessary for loop when adding admins Co-authored-by: jonpas --- launch.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/launch.py b/launch.py index 469afd4..7cca7a8 100644 --- a/launch.py +++ b/launch.py @@ -83,8 +83,7 @@ def bool_str(text): config["game"]["admins"] = [] admins = str(os.environ["GAME_ADMINS"]).split(",") admins[:] = [admin for admin in admins if admin] # Remove empty items form list - for admin in admins: - config["game"]["admins"].append(admin) + config["game"]["admins"] = admins if env_defined("GAME_SCENARIO_ID"): config["game"]["scenarioId"] = os.environ["GAME_SCENARIO_ID"] if env_defined("GAME_MAX_PLAYERS"): From b48cefb10c6dc1209d0d41a67a032ec27acec802 Mon Sep 17 00:00:00 2001 From: Simon <37269807+sdsznsk@users.noreply.github.com> Date: Thu, 23 Nov 2023 23:28:12 +0100 Subject: [PATCH 3/3] Remove clearing current config Co-authored-by: jonpas --- launch.py | 1 - 1 file changed, 1 deletion(-) diff --git a/launch.py b/launch.py index 7cca7a8..da99dea 100644 --- a/launch.py +++ b/launch.py @@ -80,7 +80,6 @@ def bool_str(text): config["game"]["passwordAdmin"] = adminPassword print(f"Admin password: {adminPassword}") if env_defined("GAME_ADMINS"): - config["game"]["admins"] = [] admins = str(os.environ["GAME_ADMINS"]).split(",") admins[:] = [admin for admin in admins if admin] # Remove empty items form list config["game"]["admins"] = admins