Allow to configure an alternative image server

This plugins implements an image server that stores uploaded images in
a git repository (by default All-Images) inside of refs/images/...
refs. Now there is a new configuration setting 'enableImageServer'
that allows disabling this image server. Instead an external image
server can be configured by defining a pattern for URLs of images that
should be embedded. Optionally also an URL for uploading images can be
configured. This is useful for companies that already run an image
server and rather want to use this server than storing the images in
Gerrit.

E.g. to configure imgur.com as image server you can add the following
configuration in gerrit.config:

  [plugin "imagare"]
    enableImageServer = false
    pattern = http:\\/\\/i\\.imgur\\.com\\/.*\\.png
    uploadUrl = http://imgur.com

Disabling the plugin image server means that the servlet to serve
images and the REST endpoints to upload/delete/list images are not
registered. Changing this configuration parameter requires a reload of
the plugin.

Images from an external image server are embedded in the UI even if
their mime type is not configured as safe in the Gerrit configuration.

Change-Id: I5022d421c5fd3ed9fdbdcf4374b6faffd9a7ff78
Signed-off-by: Edwin Kempin <ekempin@google.com>
17 files changed
tree: b5020bfc204d29cf4ef28ca4b97d1bf0ce24e8be
  1. .settings/
  2. lib/
  3. src/
  4. .buckconfig
  5. .gitignore
  6. BUCK
  7. LICENSE
  8. pom.xml