From f5d895a2051556f217b5d1c4dad0a282bbbefc65 Mon Sep 17 00:00:00 2001 From: David Sn Date: Tue, 12 Mar 2024 00:57:00 +0100 Subject: [PATCH 1/3] docs(authors): Add myself --- AUTHORS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS.md b/AUTHORS.md index 86fc4014..afaa6172 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -6,6 +6,7 @@ The following wonderful people contributed directly or indirectly to this project: +- [divadsn](https://github.com/divadsn) - [imlonghao](https://github.com/imlonghao) - [Iuri Guilherme](https://github.com/iuriguilherme) - [JuniorJPDJ](https://github.com/JuniorJPDJ) From dbaf695102cf40cc3579404371fdbe2d87437311 Mon Sep 17 00:00:00 2001 From: David Sn Date: Tue, 12 Mar 2024 01:05:47 +0100 Subject: [PATCH 2/3] fix(config): Improve admin list and bool parsing from envvars --- config.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/config.py b/config.py index c58c663e..8a825c7e 100644 --- a/config.py +++ b/config.py @@ -30,8 +30,19 @@ TOKEN = os.getenv("TOKEN", config.get("token")) WORKERS = int(os.getenv("WORKERS", config.get("workers", 32))) ADMIN_LIST = os.getenv("ADMIN_LIST", config.get("admin_list", None)) -OPEN_LOBBY = os.getenv("OPEN_LOBBY", config.get("open_lobby", True)) == "True" -ENABLE_TRANSLATIONS = os.getenv("ENABLE_TRANSLATIONS", config.get("enable_translations", False)) == "True" + +if isinstance(ADMIN_LIST, str): + ADMIN_LIST = set(int(x) for x in ADMIN_LIST.split()) + +OPEN_LOBBY = os.getenv("OPEN_LOBBY", config.get("open_lobby", True)) +ENABLE_TRANSLATIONS = os.getenv("ENABLE_TRANSLATIONS", config.get("enable_translations", False)) + +if isinstance(OPEN_LOBBY, str): + OPEN_LOBBY = OPEN_LOBBY.lower() in ("yes", "true", "t", "1") + +if isinstance(ENABLE_TRANSLATIONS, str): + ENABLE_TRANSLATIONS = ENABLE_TRANSLATIONS.lower() in ("yes", "true", "t", "1") + DEFAULT_GAMEMODE = os.getenv("DEFAULT_GAMEMODE", config.get("default_gamemode", "fast")) WAITING_TIME = int(os.getenv("WAITING_TIME", config.get("waiting_time", 120))) TIME_REMOVAL_AFTER_SKIP = int(os.getenv("TIME_REMOVAL_AFTER_SKIP", config.get("time_removal_after_skip", 20))) From 49ef6b7f7b61651a8369feae095d6949a90099b7 Mon Sep 17 00:00:00 2001 From: David Sn Date: Tue, 12 Mar 2024 01:27:05 +0100 Subject: [PATCH 3/3] chore(config): Remove unnecessary load json from string --- config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.py b/config.py index 8a825c7e..80ec0732 100644 --- a/config.py +++ b/config.py @@ -23,7 +23,7 @@ try: with open("config.json", "r") as f: - config = json.loads(f.read()) + config = json.load(f) except FileNotFoundError: config = {}