commit | 792c3d697ff93c27898d98efa20ab37a820a893f | [log] [tgz] |
---|---|---|
author | Dariusz Luksza <dariusz@luksza.org> | Sat Sep 16 14:05:04 2023 +0100 |
committer | Dariusz Luksza <dariusz@luksza.org> | Mon Sep 18 10:50:29 2023 +0100 |
tree | b02ce604ed64045668f3934fc95fc1b5d8ef8a6f | |
parent | 8ab08cce9685c0cc8db590f5f4fab1c99dd95fe9 [diff] |
Override HttpCanonicalWebUrlProvider The `canonicalWebUrl` is used in many places in Gerrit core as well as in other plugins. It provides the user facing site name that is used to build various urls. As in the virtualhost plugin we deal with multiple user facing site names, we should override the default HTTP `canonicalWebUrl` and return virtual host name, instead of the host name. Bug: Issue 299833801 Depends-On: I8321b153782e0bf8131c66ebe477902a434c6dc1 Change-Id: I641a7c7d8b8189cd9f33e188fbdc077bc0282ccb
Gerrit lib module to split the projects' space into virtual hosts similarly of what you would do with an HTTP Server and different domain names.
Build this module as it was a Gerrit plugin:
virtualhost
directory to Gerrit /plugins/virtualhost
bazel build plugins/virtualhost
virtualhost.jar
module is generated under /bazel-genfiles/plugins/virtualhost/
Copy virtualhost.jar
library to Gerrit /lib
and add the following two extra settings to gerrit.config
:
[gerrit] installModule = com.gerritforge.gerrit.modules.virtualhost.GuiceModule [httpd] filterClass = com.gerritforge.gerrit.modules.virtualhost.VirtualHostFilter
/etc/virtualhost.config contains the definition of the virtual hosts and the set of projects included.
Each server
section defines a virtual host and contains a set of projects included. Projects are defined using Gerrit ref-matching expressions and can be repeated multiple times to include multiple matchers.
Example to include all the projects starting with team1/
and the ones starting with the username:
[server "team1.mycompany.com"] projects = team1/* projects = ${username}/*
For all the other server names that are not defined and for SSH access, there is a special default section that lists of visible projects.
Example to include all the projects by default:
[default] projects = ^.*