diff options
author | James Moger <james.moger@gitblit.com> | 2012-05-02 11:36:48 -0700 |
---|---|---|
committer | James Moger <james.moger@gitblit.com> | 2012-05-02 11:36:48 -0700 |
commit | e0ae994e31c3a93a13c7b0141fe37dd1aac9b228 (patch) | |
tree | beef8211753a15ca8c2eb2609f2e4bfa7b21f1c2 | |
parent | 470a156243c9b558bc61085b5196994cf71a5090 (diff) | |
parent | 0e44acbb2fec928a1606dc60f427a148fff405c9 (diff) | |
download | gitblit-e0ae994e31c3a93a13c7b0141fe37dd1aac9b228.tar.gz gitblit-e0ae994e31c3a93a13c7b0141fe37dd1aac9b228.zip |
Merge pull request #15 from mragab/java-proxy
Java Proxy Configuration for working inside a company network behind a proxy
-rw-r--r-- | distrib/gitblit | 3 | ||||
-rw-r--r-- | distrib/gitblit-centos | 3 | ||||
-rw-r--r-- | distrib/gitblit-ubuntu | 5 | ||||
-rw-r--r-- | distrib/java-proxy-config.sh | 25 |
4 files changed, 32 insertions, 4 deletions
diff --git a/distrib/gitblit b/distrib/gitblit index 3fda9ebd..cd1f967e 100644 --- a/distrib/gitblit +++ b/distrib/gitblit @@ -5,7 +5,8 @@ set -e GITBLIT_PATH=/opt/gitblit GITBLIT_HTTP_PORT=0 GITBLIT_HTTPS_PORT=8443 -JAVA="java -server -Xmx1024M -jar" +source ${GITBLIT_PATH}/java-proxy-config.sh +JAVA="java -server -Xmx1024M ${JAVA_PROXY_CONFIG} -Djava.awt.headless=true -jar" . /lib/lsb/init-functions diff --git a/distrib/gitblit-centos b/distrib/gitblit-centos index c9fe151e..c608097e 100644 --- a/distrib/gitblit-centos +++ b/distrib/gitblit-centos @@ -8,7 +8,8 @@ GITBLIT_PATH=/opt/gitblit GITBLIT_HTTP_PORT=0 GITBLIT_HTTPS_PORT=8443 -JAVA="java -server -Xmx1024M -jar" +source ${GITBLIT_PATH}/java-proxy-config.sh +JAVA="java -server -Xmx1024M ${JAVA_PROXY_CONFIG} -Djava.awt.headless=true -jar" RETVAL=0 diff --git a/distrib/gitblit-ubuntu b/distrib/gitblit-ubuntu index 957a8d05..b047ed97 100644 --- a/distrib/gitblit-ubuntu +++ b/distrib/gitblit-ubuntu @@ -9,7 +9,8 @@ PATH=/sbin:/bin:/usr/bin:/usr/sbin # change theses values (default values) GITBLIT_PATH=/opt/gitblit GITBLIT_USER="gitblit" -ARGS="-server -Xmx1024M -jar gitblit.jar" +source ${GITBLIT_PATH}/java-proxy-config.sh +ARGS="-server -Xmx1024M ${JAVA_PROXY_CONFIG} -Djava.awt.headless=true -jar gitblit.jar" RETVAL=0 @@ -43,4 +44,4 @@ case "$1" in ;; esac -exit $RETVAL
\ No newline at end of file +exit $RETVAL diff --git a/distrib/java-proxy-config.sh b/distrib/java-proxy-config.sh new file mode 100644 index 00000000..5f7a2a27 --- /dev/null +++ b/distrib/java-proxy-config.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +# To set the proxy configuration, specify the following host name and port +#PROXY_HOST= +#PROXY_PORT= + +# To exclude any hosts from proxy configuration such that they directly accessed by Gitblit without passing through the proxy server, append the host name to the following variable using "|" as the separator +NON_PROXY_HOSTS="localhost|127.0.0.*|*.local|192.168.*.*|10.193.*.*" + +### The following should not need to be modified + +JAVA_PROXY_CONFIG="" + +if [ -n "${PROXY_HOST}" -a -n "${PROXY_PORT}" ]; then + + JAVA_PROXY_CONFIG=" -DproxySet=true -Dhttp.proxyHost=${PROXY_HOST} -Dhttp.proxyPort=${PROXY_PORT} -Dhttps.proxyHost=${PROXY_HOST} -Dhttps.proxyPort=${PROXY_PORT} -Dftp.proxyHost=${PROXY_HOST} -Dftp.proxyPort=${PROXY_PORT} " +fi + +if [ -n "${PROXY_HOST}" -a -n "${PROXY_PORT}" -a -n "${NON_PROXY_HOSTS}" ]; then + + JAVA_PROXY_CONFIG="${JAVA_PROXY_CONFIG} -Dhttp.nonProxyHosts=\"${NON_PROXY_HOSTS}\" -Dftp.nonProxyHosts=\"${NON_PROXY_HOSTS}\" " +fi + +export JAVA_PROXY_CONFIG + |