diff options
| author | Игорь Толмачёв <igorechek06@noreply.codeberg.org> | 2024-04-22 12:21:07 +0000 |
|---|---|---|
| committer | Igor Tolmachev <me@igorek.dev> | 2024-04-23 00:28:49 +0900 |
| commit | 1cb2acd647efa5fb36b84aff246cabc9aaad9140 (patch) | |
| tree | 0a88e66f939e942aadc5cfcef2927d678d7817e2 /config.py | |
| download | minecraft_http_whitelist-1cb2acd647efa5fb36b84aff246cabc9aaad9140.tar.gz minecraft_http_whitelist-1cb2acd647efa5fb36b84aff246cabc9aaad9140.zip | |
Diffstat (limited to 'config.py')
| -rw-r--r-- | config.py | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/config.py b/config.py new file mode 100644 index 0000000..437b9d8 --- /dev/null +++ b/config.py | |||
| @@ -0,0 +1,31 @@ | |||
| 1 | from typing import Literal | ||
| 2 | |||
| 3 | # Port of minecraft HTTP whitelist server | ||
| 4 | http_port = 25564 | ||
| 5 | |||
| 6 | # pipe - https://www.freedesktop.org/software/systemd/man/latest/systemd.exec.html#StandardInput= | ||
| 7 | # rcon - https://minecraft.fandom.com/wiki/Server.properties#enable-rcon | ||
| 8 | whitelist_access_type: Literal["pipe", "rcon"] = "rcon" | ||
| 9 | # Path to whitelist.json file | ||
| 10 | # Usually located in the root of the minecraft server folder | ||
| 11 | whitelist_file_path = "~/minecraft/whitelist.json" | ||
| 12 | # Enabled endpoints | ||
| 13 | # GET - get users in the whitelist | ||
| 14 | # POST - add user to the whitelist | ||
| 15 | # DELETE - delete user from the whitelist | ||
| 16 | enabled_endpoints: set[Literal["GET", "POST", "DELETE"]] = { | ||
| 17 | "GET", | ||
| 18 | "POST", | ||
| 19 | # "DELETE", | ||
| 20 | } | ||
| 21 | |||
| 22 | if whitelist_access_type == "pipe": | ||
| 23 | # Path to PIPE file | ||
| 24 | pipe_path = "~/minecraft/console" | ||
| 25 | elif whitelist_access_type == "rcon": | ||
| 26 | # RCON server port - https://minecraft.fandom.com/wiki/Server.properties#rcon.port | ||
| 27 | rcon_port = 25575 | ||
| 28 | # RCON server password - https://minecraft.fandom.com/wiki/Server.properties#rcon.password | ||
| 29 | rcon_password = "password" | ||
| 30 | else: | ||
| 31 | raise ValueError("Unsupported access type") | ||
