mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2026-02-24 18:16:24 +00:00
Fixed HTTP proxy handling for operations using mc-image-helper (#3598)
This commit is contained in:
@@ -101,14 +101,28 @@ if isTrue "${ENABLE_AUTOPAUSE}" && isTrue "${ENABLE_AUTOSTOP}"; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
proxyArgs=()
|
||||
if [[ $PROXY ]]; then
|
||||
export http_proxy="$PROXY"
|
||||
export https_proxy="$PROXY"
|
||||
export JAVA_TOOL_OPTIONS+="-Djava.net.useSystemProxies=true"
|
||||
log "INFO: Giving proxy time to startup..."
|
||||
sleep 5
|
||||
# only calculate fallback
|
||||
: "${PROXY_HOST=$(echo "$PROXY" | cut -d : -f 1)}"
|
||||
: "${PROXY_PORT=$(echo "$PROXY" | cut -d : -f 2)}"
|
||||
proxyArgs+=(-Djava.net.useSystemProxies=true)
|
||||
fi
|
||||
|
||||
# https://docs.oracle.com/javase/7/docs/api/java/net/doc-files/net-properties.html
|
||||
proxyArgs=()
|
||||
function addToProxyArgs() {
|
||||
if [[ $2 ]]; then
|
||||
proxyArgs+=("-D$1=$2")
|
||||
fi
|
||||
}
|
||||
addToProxyArgs http.proxyHost "${PROXY_HOST:-}"
|
||||
addToProxyArgs http.proxyPort "${PROXY_PORT:-}"
|
||||
addToProxyArgs http.nonProxyHosts "${PROXY_NON_PROXY_HOSTS:-}"
|
||||
export JAVA_TOOL_OPTIONS+=" ${proxyArgs[*]}"
|
||||
|
||||
function fixJavaPath() {
|
||||
# Some Docker management UIs grab all the image declared variables and present them for configuration.
|
||||
# When upgrading images across Java versions, that creates a mismatch in PATH's expected by base image.
|
||||
|
||||
Reference in New Issue
Block a user