aboutsummaryrefslogtreecommitdiff
path: root/gitweb/gitweb.perl
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2011-08-08 12:33:34 -0700
committerJunio C Hamano <gitster@pobox.com>2011-08-08 12:33:34 -0700
commit86bd7f99892238d36c62c18477ea360037ac19dc (patch)
tree5ee8dc3d7a53e2110a8bffda01f51ff1b7e0246f /gitweb/gitweb.perl
parent75745bc7041a17f6cebf719a50157eb5b1d3bfe9 (diff)
parent131d6afcba657f9348031ee2e20f62d25d69ce7a (diff)
downloadgit-86bd7f99892238d36c62c18477ea360037ac19dc.tar.gz
git-86bd7f99892238d36c62c18477ea360037ac19dc.tar.xz
Merge branch 'jn/gitweb-system-config'
* jn/gitweb-system-config: gitweb: Introduce common system-wide settings for convenience
Diffstat (limited to 'gitweb/gitweb.perl')
-rwxr-xr-xgitweb/gitweb.perl18
1 files changed, 15 insertions, 3 deletions
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 48def3841..c7ce03827 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -665,13 +665,25 @@ sub read_config_file {
return;
}
-our ($GITWEB_CONFIG, $GITWEB_CONFIG_SYSTEM);
+our ($GITWEB_CONFIG, $GITWEB_CONFIG_SYSTEM, $GITWEB_CONFIG_COMMON);
sub evaluate_gitweb_config {
our $GITWEB_CONFIG = $ENV{'GITWEB_CONFIG'} || "++GITWEB_CONFIG++";
our $GITWEB_CONFIG_SYSTEM = $ENV{'GITWEB_CONFIG_SYSTEM'} || "++GITWEB_CONFIG_SYSTEM++";
+ our $GITWEB_CONFIG_COMMON = $ENV{'GITWEB_CONFIG_COMMON'} || "++GITWEB_CONFIG_COMMON++";
- # use first config file that exists
- read_config_file($GITWEB_CONFIG) or
+ # Protect agains duplications of file names, to not read config twice.
+ # Only one of $GITWEB_CONFIG and $GITWEB_CONFIG_SYSTEM is used, so
+ # there possibility of duplication of filename there doesn't matter.
+ $GITWEB_CONFIG = "" if ($GITWEB_CONFIG eq $GITWEB_CONFIG_COMMON);
+ $GITWEB_CONFIG_SYSTEM = "" if ($GITWEB_CONFIG_SYSTEM eq $GITWEB_CONFIG_COMMON);
+
+ # Common system-wide settings for convenience.
+ # Those settings can be ovverriden by GITWEB_CONFIG or GITWEB_CONFIG_SYSTEM.
+ read_config_file($GITWEB_CONFIG_COMMON);
+
+ # Use first config file that exists. This means use the per-instance
+ # GITWEB_CONFIG if exists, otherwise use GITWEB_SYSTEM_CONFIG.
+ read_config_file($GITWEB_CONFIG) and return;
read_config_file($GITWEB_CONFIG_SYSTEM);
}