From 8756c97fabc026215944270e548c3da2d36152e5 Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Fri, 14 Jul 2023 07:43:49 -0500 Subject: [PATCH] Only remove allowlist.json when ALLOW_LIST_USERS is set to empty string (#338) --- bedrock-entry.sh | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/bedrock-entry.sh b/bedrock-entry.sh index ad9404f..c0f43d0 100755 --- a/bedrock-entry.sh +++ b/bedrock-entry.sh @@ -165,22 +165,25 @@ if [ -n "$OPS" ] || [ -n "$MEMBERS" ] || [ -n "$VISITORS" ]; then ]| flatten' > permissions.json fi -allowListUsers=${ALLOW_LIST_USERS:-${WHITE_LIST_USERS}} -if [ -n "$allowListUsers" ]; then - echo "Setting allow list" - f=allowlist.json - rm -rf "$f" - jq -c -n --arg users "$allowListUsers" '$users | split(",") | map({"ignoresPlayerLimit":false,"name": .})' > "$f" - # activate server property to enable list usage - WHITE_LIST=true - ALLOW_LIST=true -else - rm -rf whitelist.json allowlist.json - : "${WHITE_LIST:=false}" - : "${ALLOW_LIST:=false}" +if [[ -v ALLOW_LIST_USERS || -v WHITE_LIST_USERS ]]; then + allowListUsers=${ALLOW_LIST_USERS:-${WHITE_LIST_USERS}} + + if [[ $allowListUsers ]]; then + echo "Setting allow list" + f=allowlist.json + rm -rf "$f" + jq -c -n --arg users "$allowListUsers" '$users | split(",") | map({"ignoresPlayerLimit":false,"name": .})' > "$f" + # activate server property to enable list usage + WHITE_LIST=true + ALLOW_LIST=true + else + rm -rf whitelist.json allowlist.json + WHITE_LIST=false + ALLOW_LIST=false + fi + export WHITE_LIST ALLOW_LIST fi -export WHITE_LIST ALLOW_LIST set-property --file server.properties --bulk /etc/bds-property-definitions.json