Skip to content

Commit 3a14060

Browse files
authored
prioritizing /config sync over default downloading (#265)
1 parent 7dce954 commit 3a14060

File tree

1 file changed

+28
-24
lines changed

1 file changed

+28
-24
lines changed

scripts/run-bungeecord.sh

Lines changed: 28 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,8 @@ function processConfigs {
218218
fi
219219
fi
220220

221+
downloadDefaultConfigs
222+
221223
# Replace environment variables in config files
222224
if isTrue "${REPLACE_ENV_VARIABLES}"; then
223225
log "Replacing env variables in configs that match the prefix $REPLACE_ENV_VARIABLE_PREFIX..."
@@ -281,6 +283,32 @@ function buildDownloadList() {
281283
echo "$result"
282284
}
283285

286+
function downloadDefaultConfigs() {
287+
if isFalse "$SKIP_DOWNLOAD_DEFAULTS"; then
288+
if [[ $DOWNLOAD_DEFAULTS ]]; then
289+
log "Downloading default top-level configs, if needed"
290+
if ! mc-image-helper mcopy \
291+
--to /server \
292+
--skip-existing --skip-up-to-date=false \
293+
"$DOWNLOAD_DEFAULTS" 2> /dev/null; then
294+
logWarning "One or more default files were not available from $DOWNLOAD_DEFAULTS"
295+
fi
296+
fi
297+
298+
if [[ "${family}" == "velocity" ]]; then
299+
SECRET_FILE="/server/forwarding.secret"
300+
301+
if [ ! -f "$SECRET_FILE" ]; then
302+
# generate 32 random alphanumeric characters
303+
head /dev/urandom | tr -dc 'A-Za-z0-9' | head -c 32 > "$SECRET_FILE"
304+
log "Created $SECRET_FILE"
305+
else
306+
log "$SECRET_FILE already exists"
307+
fi
308+
fi
309+
fi
310+
}
311+
284312
### MAIN
285313

286314
handleDebugMode
@@ -346,30 +374,6 @@ if isTrue "$download_required"; then
346374
fi
347375
fi
348376

349-
if isFalse "$SKIP_DOWNLOAD_DEFAULTS"; then
350-
if [[ $DOWNLOAD_DEFAULTS ]]; then
351-
log "Downloading default top-level configs, if needed"
352-
if ! mc-image-helper mcopy \
353-
--to /server \
354-
--skip-existing --skip-up-to-date=false \
355-
"$DOWNLOAD_DEFAULTS" 2> /dev/null; then
356-
logWarning "One or more default files were not available from $DOWNLOAD_DEFAULTS"
357-
fi
358-
fi
359-
360-
if [[ "${family}" == "velocity" ]]; then
361-
SECRET_FILE="/server/forwarding.secret"
362-
363-
if [ ! -f "$SECRET_FILE" ]; then
364-
# generate 32 random alphanumeric characters
365-
head /dev/urandom | tr -dc 'A-Za-z0-9' | head -c 32 > "$SECRET_FILE"
366-
log "Created $SECRET_FILE"
367-
else
368-
log "$SECRET_FILE already exists"
369-
fi
370-
fi
371-
fi
372-
373377
if [ -n "$ICON" ]; then
374378
if [ ! -e server-icon.png ] || isTrue "${OVERRIDE_ICON}"; then
375379
log "Using server icon from $ICON..."

0 commit comments

Comments
 (0)