Skip to content

Commit 0c4a78f

Browse files
committed
Added support for allowlist.json
#148
1 parent 3cf8c20 commit 0c4a78f

File tree

3 files changed

+18
-5
lines changed

3 files changed

+18
-5
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,8 @@ There are two ways to handle a whitelist. The first is to set the `WHITE_LIST` e
142142
-e WHITE_LIST_USERS="player1,player2,player3"
143143
```
144144

145+
> Starting with 1.16.230.50, `ALLOW_LIST`, `ALLOW_LIST_USERS`, and the file `allowlist.json` will be used instead.
146+
145147
## More information
146148

147149
For more information about managing Bedrock Dedicated Servers in general, [check out this Reddit post](https://old.reddit.com/user/ProfessorValko/comments/9f438p/bedrock_dedicated_server_tutorial/).

bedrock-entry.sh

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -115,12 +115,19 @@ if [ -n "$OPS" ] || [ -n "$MEMBERS" ] || [ -n "$VISITORS" ]; then
115115
]| flatten' > permissions.json
116116
fi
117117

118-
if [ -n "$WHITE_LIST_USERS" ]; then
119-
echo "Setting whitelist"
120-
rm -rf whitelist.json
121-
jq -n --arg users "$WHITE_LIST_USERS" '$users | split(",") | map({"name": .})' > whitelist.json
122-
# flag whitelist to true so the server properties process correctly
118+
allowListUsers=${ALLOW_LIST_USERS:-${WHITE_LIST_USERS}}
119+
120+
if [ -n "$allowListUsers" ]; then
121+
echo "Setting allow list"
122+
for f in whitelist.json allowlist.json; do
123+
if [ -f $f ]; then
124+
rm -rf $f
125+
jq -n --arg users "$allowListUsers" '$users | split(",") | map({"name": .})' > $f
126+
fi
127+
done
128+
# activate server property to enable list usage
123129
export WHITE_LIST=true
130+
export ALLOW_LIST=true
124131
fi
125132

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

property-definitions.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@
5151
"env": "WHITE_LIST",
5252
"allowed": ["true","false"]
5353
},
54+
"allow-list": {
55+
"env": "ALLOW_LIST",
56+
"allowed": ["true","false"]
57+
},
5458
"view-distance": {
5559
"env": "VIEW_DISTANCE"
5660
},

0 commit comments

Comments
 (0)