Skip to content

Commit 8756c97

Browse files
authored
Only remove allowlist.json when ALLOW_LIST_USERS is set to empty string (#338)
1 parent a77ed28 commit 8756c97

File tree

1 file changed

+18
-15
lines changed

1 file changed

+18
-15
lines changed

bedrock-entry.sh

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -165,22 +165,25 @@ if [ -n "$OPS" ] || [ -n "$MEMBERS" ] || [ -n "$VISITORS" ]; then
165165
]| flatten' > permissions.json
166166
fi
167167

168-
allowListUsers=${ALLOW_LIST_USERS:-${WHITE_LIST_USERS}}
169-
170-
if [ -n "$allowListUsers" ]; then
171-
echo "Setting allow list"
172-
f=allowlist.json
173-
rm -rf "$f"
174-
jq -c -n --arg users "$allowListUsers" '$users | split(",") | map({"ignoresPlayerLimit":false,"name": .})' > "$f"
175-
# activate server property to enable list usage
176-
WHITE_LIST=true
177-
ALLOW_LIST=true
178-
else
179-
rm -rf whitelist.json allowlist.json
180-
: "${WHITE_LIST:=false}"
181-
: "${ALLOW_LIST:=false}"
168+
169+
if [[ -v ALLOW_LIST_USERS || -v WHITE_LIST_USERS ]]; then
170+
allowListUsers=${ALLOW_LIST_USERS:-${WHITE_LIST_USERS}}
171+
172+
if [[ $allowListUsers ]]; then
173+
echo "Setting allow list"
174+
f=allowlist.json
175+
rm -rf "$f"
176+
jq -c -n --arg users "$allowListUsers" '$users | split(",") | map({"ignoresPlayerLimit":false,"name": .})' > "$f"
177+
# activate server property to enable list usage
178+
WHITE_LIST=true
179+
ALLOW_LIST=true
180+
else
181+
rm -rf whitelist.json allowlist.json
182+
WHITE_LIST=false
183+
ALLOW_LIST=false
184+
fi
185+
export WHITE_LIST ALLOW_LIST
182186
fi
183-
export WHITE_LIST ALLOW_LIST
184187

185188
set-property --file server.properties --bulk /etc/bds-property-definitions.json
186189

0 commit comments

Comments
 (0)