Allow to configure own URL instead of relying on httpd.listenUrl

The JGroupsPeerInfoProvider was using the value of httpd.listenUrl [1]
from the gerrit.config to detect its own URL, which is broadcast to
the jgroups channel for other peers to discover.

There were several problems with this approach.

- The httpd.listenUrl can be configured with a reverse proxy, for
  example:

    [httpd]
      listenUrl = proxy-https://localhost:9080

  When a site is configured in such a way, using the URL as-is causes
  the peer's HTTP POST requests to fail with the error:

    "proxy-https protocol is not supported"

- When configured with a reverse-proxy, the listenUrl's port might be
  bound only to 127.0.0.1, which means it will be inaccessible from
  the peer machine.

- The listenUrl's hostname may be configured as `*` to listen on all
  local addresses. In this case the URL must be rewritten to replace
  the `*` with a valid hostname.

- It is allowed to specify multiple values for httpd.listenUrl, but
  the provider is only reading a single value from the configuration.

Rather than trying to handle these cases, allow to explicitly specify
the own URL in the JGroups peer info section of the plugin's config
file (etc/high-availability.config):

  [peerInfo]
    strategy = jgroups
  [peerInfo "jgroups"]
    myUrl = https://myserver:8080/

If the myUrl value is not specified, fall back to httpd.listenUrl, but
fail early if its value is not reasonable, i.e. require it to be a
single value with an explicit hostname.

[1] http://gerrit-documentation.storage.googleapis.com/Documentation/2.14/config-gerrit.html#httpd.listenUrl

Change-Id: Ifd97c751eea5e1eb99e70b3f02f5d80d8c368540
5 files changed