Add DIRECT_DOWNLOAD_URL environment variable (#523)

This commit is contained in:
meek2100 authored and GitHub committed 2025-06-12 20:14:00 -05:00
1 parent 25ce8187be
commit de15d694e5
2 files changed
+20

No files matched your search

+2
View File
@@ -43,6 +43,8 @@ For Minecraft Java Edition you'll need to use this image instead:
bedrock server process
- `TZ` (no default): can be set to a specific timezone like `America/New_York`. This will set the timezone for the Docker container and therefore their logs. Addtionally, if you want to sync the time with the host, you can mount the `/etc/localtime` file from the host to the container like `/etc/localtime:/etc/localtime:ro`.
- `PACKAGE_BACKUP_KEEP` (`2`) : how many package backups to keep
- `DIRECT_DOWNLOAD_URL` (no default): This environment variable can be used to provide a **direct download URL** for the Minecraft Bedrock server `.zip` file. When set, this URL will be used instead of attempting to automatically look up the download link from `minecraft.net`. This is particularly useful for CI/CD environments or when the automatic version lookup is temporarily broken due to website changes. Ensure the URL points directly to the `bedrock-server-VERSION.zip` file.
### Server Properties
+18
View File
@@ -81,6 +81,23 @@ if [[ ${EULA^^} != TRUE ]]; then
exit 1
fi
# Check for DIRECT_DOWNLOAD_URL override first
if [[ -n "${DIRECT_DOWNLOAD_URL}" ]]; then
echo "Using direct download URL from DIRECT_DOWNLOAD_URL environment variable."
DOWNLOAD_URL="${DIRECT_DOWNLOAD_URL}"
# If VERSION is not explicitly set, try to extract it from the URL
if [[ -z "${VERSION}" ]]; then
if [[ "${DOWNLOAD_URL}" =~ bedrock-server-([0-9\.]+)\.zip ]]; then
VERSION=${BASH_REMATCH[1]}
echo "Extracted VERSION=${VERSION} from DIRECT_DOWNLOAD_URL."
else
echo "WARNING: Could not extract VERSION from DIRECT_DOWNLOAD_URL. Please ensure VERSION environment variable is set."
# Optionally exit here if VERSION is strictly required, but for testing, often the test will fail later.
fi
else
echo "VERSION=${VERSION} is explicitly set, using it with DIRECT_DOWNLOAD_URL."
fi
else # Original logic: if DIRECT_DOWNLOAD_URL is NOT set, proceed with lookup
case ${VERSION^^} in
PREVIEW)
echo "Looking up latest preview version..."
@@ -101,6 +118,7 @@ case ${VERSION^^} in
fi
;;
esac
fi
if [[ ! -f "bedrock_server-${VERSION}" ]]; then