Don't start Gerrit replica if container.replica is not true

If the container.replica option is not set to true in the
gerrit.config, the Gerrit replica should not start. Although the
Gerrit daemon is forcibly started in replica mode, some plugins
or components in Gerrit core may still rely on this option and
would fail.

Change-Id: I8c0772d3b59087bf6eed19ea3477cb0f626b658f
diff --git a/container-images/gerrit-replica/tools/start b/container-images/gerrit-replica/tools/start
index 5433086..ad7788f 100755
--- a/container-images/gerrit-replica/tools/start
+++ b/container-images/gerrit-replica/tools/start
@@ -12,6 +12,12 @@
 # from secrets/configmaps in Kubernetes make the containing directory read-only.
 symlink_config_to_site
 
+IS_REPLICA=$(git config -f /var/gerrit/etc/gerrit.config --get container.replica)
+if [[ ! "$IS_REPLICA" == "true" ]]; then
+  echo "`container.replica` in `gerrit.config` has to be `true`"
+  exit 1
+fi
+
 # workaround gerrit.sh does not start httpd
 JAVA_OPTIONS=$(git config --file /var/gerrit/etc/gerrit.config --get-all container.javaOptions)
 java ${JAVA_OPTIONS} -jar /var/gerrit/bin/gerrit.war daemon \