Index: testing_support/gerrit-init.sh |
diff --git a/testing_support/gerrit-init.sh b/testing_support/gerrit-init.sh |
index b834fb814c13639e9edd0b290a252ccb331c2597..0f3ab32d9366dd7737e8baa8feb2d577297cf825 100755 |
--- a/testing_support/gerrit-init.sh |
+++ b/testing_support/gerrit-init.sh |
@@ -5,6 +5,9 @@ |
set -e |
+http_port=8080 |
+ssh_port=29418 |
+ |
while test $# -ne 0; do |
case "$1" in |
-v) |
@@ -15,6 +18,14 @@ while test $# -ne 0; do |
rundir="$2" |
shift |
;; |
+ --http-port) |
+ http_port="$2" |
+ shift |
+ ;; |
+ --ssh-port) |
+ ssh_port="$2" |
+ shift |
+ ;; |
*) |
rundir="$1" |
;; |
@@ -137,6 +148,12 @@ cat <<EOF > "${rundir}/etc/gerrit.config" |
[auth] |
type = http |
gitBasicAuth = true |
+[gerrit] |
+ canonicalWebUrl = http://$(hostname):${http_port}/ |
+[httpd] |
+ listenUrl = http://*:${http_port}/ |
+[sshd] |
+ listenAddress = *:${ssh_port} |
EOF |
# Initialize the gerrit instance. |
@@ -164,22 +181,24 @@ EOF |
# Create a .git-credentials file, to enable password-less push. |
cat <<EOF > "${rundir}/tmp/.git-credentials" |
-http://${username}:${password}@localhost:8080 |
+http://${username}:${password}@localhost:${http_port} |
EOF |
-echo |
-echo "To start gerrit server:" |
-echo " ${rundir}/bin/gerrit.sh start" |
-echo |
-echo "To use the REST API:" |
-echo " curl --netrc-file ${rundir}/tmp/.netrc http://localhost:8080/<endpoint>" |
-echo |
-echo "To use SSH API:" |
-echo " ssh ${username}@localhost -p 29418 -i ${rundir}/tmp/id_rsa gerrit" |
-echo |
-echo "To enable 'git push' without a password prompt:" |
-echo " git config credential.helper 'store --file=${rundir}/tmp/.git-credentials'" |
-echo |
-echo "To stop the server:" |
-echo " ${rundir}/bin/gerrit.sh stop" |
-echo |
+cat <<EOF |
+ |
+To start gerrit server: |
+ ${rundir}/bin/gerrit.sh start |
+ |
+To use the REST API: |
+ curl --netrc-file ${rundir}/tmp/.netrc http://localhost:${http_port}/<endpoint> |
+ |
+To use SSH API: |
+ ssh ${username}@localhost -p ${ssh_port} -i ${rundir}/tmp/id_rsa gerrit |
+ |
+To enable 'git push' without a password prompt: |
+ git config credential.helper 'store --file=${rundir}/tmp/.git-credentials' |
+ |
+To stop the server: |
+ ${rundir}/bin/gerrit.sh stop |
+ |
+EOF |