Expose httpd.listenUrl as an environment variable httpd.listenUrl is exposed via the HTTPD_LISTEN_URL environment variable Change-Id: I8e3538268d7bed950cf88a4b39544dbc76b63b07
diff --git a/README.md b/README.md index 2fac467..094bad6 100644 --- a/README.md +++ b/README.md
@@ -85,6 +85,14 @@ Run ```docker-compose up``` to trigger the build and execution of your custom Gerrit docker setup. +## Environment variables + +This is a list of available environment variables to change the Gerrit configuration: + +* `CANONICAL_WEB_URL`: Optional. Set the `gerrit.canonicalWebUrl` parameter in `gerrit.config`. +Defaults to `http://<image_hostname>` +* `HTTPD_LISTEN_URL`: Optional. Override the `httpd.listenUrl` parameter in `gerrit.config`. + ## Using Gerrit in production When running Gerrit on Docker in production, it is a good idea to rely on a physical external
diff --git a/centos/7/Dockerfile b/centos/7/Dockerfile index 09bf078..5551719 100644 --- a/centos/7/Dockerfile +++ b/centos/7/Dockerfile
@@ -18,6 +18,7 @@ USER gerrit ENV CANONICAL_WEB_URL= +ENV HTTPD_LISTEN_URL= # Allow incoming traffic EXPOSE 29418 8080
diff --git a/centos/7/Dockerfile-dev b/centos/7/Dockerfile-dev index 2c2ee44..dfba96d 100644 --- a/centos/7/Dockerfile-dev +++ b/centos/7/Dockerfile-dev
@@ -26,6 +26,7 @@ git config --add -f /var/gerrit/etc/gerrit.config container.javaOptions "-Djava.security.egd=file:/dev/./urandom" ENV CANONICAL_WEB_URL= +ENV HTTPD_LISTEN_URL= # Allow incoming traffic EXPOSE 29418 8080
diff --git a/centos/7/entrypoint.sh b/centos/7/entrypoint.sh index cb459b5..bf40fc8 100755 --- a/centos/7/entrypoint.sh +++ b/centos/7/entrypoint.sh
@@ -9,6 +9,10 @@ fi git config -f /var/gerrit/etc/gerrit.config gerrit.canonicalWebUrl "${CANONICAL_WEB_URL:-http://$HOSTNAME}" +if [ ${HTTPD_LISTEN_URL} ]; +then + git config -f /var/gerrit/etc/gerrit.config httpd.listenUrl ${HTTPD_LISTEN_URL} +fi if [ "$1" != "init" ] then
diff --git a/ubuntu/18/Dockerfile b/ubuntu/18/Dockerfile index f945529..f3e3008 100644 --- a/ubuntu/18/Dockerfile +++ b/ubuntu/18/Dockerfile
@@ -24,6 +24,7 @@ USER gerrit ENV CANONICAL_WEB_URL= +ENV HTTPD_LISTEN_URL= # Allow incoming traffic EXPOSE 29418 8080
diff --git a/ubuntu/18/Dockerfile-dev b/ubuntu/18/Dockerfile-dev index 761b9d6..a0a35ae 100644 --- a/ubuntu/18/Dockerfile-dev +++ b/ubuntu/18/Dockerfile-dev
@@ -24,6 +24,7 @@ git config --add -f /var/gerrit/etc/gerrit.config container.javaOptions "-Djava.security.egd=file:/dev/./urandom" ENV CANONICAL_WEB_URL= +ENV HTTPD_LISTEN_URL= # Allow incoming traffic EXPOSE 29418 8080
diff --git a/ubuntu/18/entrypoint.sh b/ubuntu/18/entrypoint.sh index cb459b5..bf40fc8 100755 --- a/ubuntu/18/entrypoint.sh +++ b/ubuntu/18/entrypoint.sh
@@ -9,6 +9,10 @@ fi git config -f /var/gerrit/etc/gerrit.config gerrit.canonicalWebUrl "${CANONICAL_WEB_URL:-http://$HOSTNAME}" +if [ ${HTTPD_LISTEN_URL} ]; +then + git config -f /var/gerrit/etc/gerrit.config httpd.listenUrl ${HTTPD_LISTEN_URL} +fi if [ "$1" != "init" ] then