Browse Source

Added a script to facilitate setting the proxy host and port and no proxy hosts, and then it concatenates all the java system properties for setting the java proxy configurations and puts the resulting string in an environment variable JAVA_PROXY_CONFIG, modified the scirpts gitblit, gitblit-ubuntu, and gitblit-centos to source the java-proxy-config.sh script and then include the resulting java proxy configuration in the java command

tags/v1.0.0
Mohamed Ragab 12 years ago
parent
commit
0e44acbb2f
4 changed files with 32 additions and 4 deletions
  1. 2
    1
      distrib/gitblit
  2. 2
    1
      distrib/gitblit-centos
  3. 3
    2
      distrib/gitblit-ubuntu
  4. 25
    0
      distrib/java-proxy-config.sh

+ 2
- 1
distrib/gitblit View File

@@ -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


+ 2
- 1
distrib/gitblit-centos View File

@@ -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


+ 3
- 2
distrib/gitblit-ubuntu View File

@@ -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
exit $RETVAL

+ 25
- 0
distrib/java-proxy-config.sh View File

@@ -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


Loading…
Cancel
Save