Add DIRECT_DOWNLOAD_URL environment variable (#523)
This commit is contained in:
1 parent
25ce8187be
commit
de15d694e5
2 files changed
+38
-18
No files matched your search
@@ -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
|
||||
|
||||
|
||||
+36
-18
@@ -81,26 +81,44 @@ if [[ ${EULA^^} != TRUE ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
case ${VERSION^^} in
|
||||
PREVIEW)
|
||||
echo "Looking up latest preview version..."
|
||||
lookupVersion serverBedrockPreviewLinux
|
||||
;;
|
||||
LATEST)
|
||||
echo "Looking up latest version..."
|
||||
lookupVersion serverBedrockLinux
|
||||
;;
|
||||
*)
|
||||
# use the given version exactly
|
||||
if isTrue "$PREVIEW"; then
|
||||
echo "Using given preview version ${VERSION}"
|
||||
lookupVersion serverBedrockPreviewLinux "${VERSION}"
|
||||
# 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 "Using given version ${VERSION}"
|
||||
lookupVersion serverBedrockLinux "${VERSION}"
|
||||
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
|
||||
;;
|
||||
esac
|
||||
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..."
|
||||
lookupVersion serverBedrockPreviewLinux
|
||||
;;
|
||||
LATEST)
|
||||
echo "Looking up latest version..."
|
||||
lookupVersion serverBedrockLinux
|
||||
;;
|
||||
*)
|
||||
# use the given version exactly
|
||||
if isTrue "$PREVIEW"; then
|
||||
echo "Using given preview version ${VERSION}"
|
||||
lookupVersion serverBedrockPreviewLinux "${VERSION}"
|
||||
else
|
||||
echo "Using given version ${VERSION}"
|
||||
lookupVersion serverBedrockLinux "${VERSION}"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
if [[ ! -f "bedrock_server-${VERSION}" ]]; then
|
||||
|
||||
|
||||
Reference in new issue
Block a user