Only remove allowlist.json when ALLOW_LIST_USERS is set to empty string (#338)

This commit is contained in:
Geoff Bourne authored and GitHub committed 2023-07-14 07:43:49 -05:00
1 parent a77ed28d69
commit 8756c97fab
1 file changed
+17 -14
+17 -14
View File
@@ -165,22 +165,25 @@ if [ -n "$OPS" ] || [ -n "$MEMBERS" ] || [ -n "$VISITORS" ]; then
]| flatten' > permissions.json ]| flatten' > permissions.json
fi fi
allowListUsers=${ALLOW_LIST_USERS:-${WHITE_LIST_USERS}}
if [ -n "$allowListUsers" ]; then if [[ -v ALLOW_LIST_USERS || -v WHITE_LIST_USERS ]]; then
echo "Setting allow list" allowListUsers=${ALLOW_LIST_USERS:-${WHITE_LIST_USERS}}
f=allowlist.json
rm -rf "$f" if [[ $allowListUsers ]]; then
jq -c -n --arg users "$allowListUsers" '$users | split(",") | map({"ignoresPlayerLimit":false,"name": .})' > "$f" echo "Setting allow list"
# activate server property to enable list usage f=allowlist.json
WHITE_LIST=true rm -rf "$f"
ALLOW_LIST=true jq -c -n --arg users "$allowListUsers" '$users | split(",") | map({"ignoresPlayerLimit":false,"name": .})' > "$f"
else # activate server property to enable list usage
rm -rf whitelist.json allowlist.json WHITE_LIST=true
: "${WHITE_LIST:=false}" ALLOW_LIST=true
: "${ALLOW_LIST:=false}" else
rm -rf whitelist.json allowlist.json
WHITE_LIST=false
ALLOW_LIST=false
fi
export WHITE_LIST ALLOW_LIST
fi fi
export WHITE_LIST ALLOW_LIST
set-property --file server.properties --bulk /etc/bds-property-definitions.json set-property --file server.properties --bulk /etc/bds-property-definitions.json