summaryrefslogtreecommitdiff
path: root/gitweb
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2008-04-09 00:44:48 -0700
committerJunio C Hamano <gitster@pobox.com>2008-04-09 00:44:48 -0700
commit018465d998a02376ba62e2de3ac707bc98322141 (patch)
treeabac78775aa4fa54a892da0ce3930ae1196da5f2 /gitweb
parent3c993de9f25d052b791c55609468c59bcd47fc19 (diff)
parent26ffcb7690139dd53f5deb4f875895f22bebee4f (diff)
downloadgit-018465d998a02376ba62e2de3ac707bc98322141.tar.gz
Merge branch 'gp/gitweb'
* gp/gitweb: gitweb: fallback to system-wide config file (fixup) gitweb: fallback to system-wide config file if default config does not exist
Diffstat (limited to 'gitweb')
-rw-r--r--gitweb/INSTALL6
-rw-r--r--gitweb/README9
-rwxr-xr-xgitweb/gitweb.perl7
3 files changed, 19 insertions, 3 deletions
diff --git a/gitweb/INSTALL b/gitweb/INSTALL
index 9cd5b0a2b1..743f2d4442 100644
--- a/gitweb/INSTALL
+++ b/gitweb/INSTALL
@@ -95,7 +95,11 @@ for gitweb (in gitweb/README).
by default it is file named gitweb_config.perl in the same place as
gitweb.cgi script. You can control default place for config file
using GITWEB_CONFIG build configuration variable, and you can set it
- using GITWEB_CONFIG environmental variable.
+ using GITWEB_CONFIG environmental variable. If this file does not
+ exist, gitweb looks for a system-wide configuration file, normally
+ /etc/gitweb.conf. You can change the default using the
+ GITWEB_CONFIG_SYSTEM build configuration variable, and override it
+ through GITWEB_CONFIG_SYSTEM environmental variable.
- Gitweb config file is [fragment] of perl code. You can set variables
using "our $variable = value"; text from "#" character until the end
diff --git a/gitweb/README b/gitweb/README
index 2163071047..8dfe335f73 100644
--- a/gitweb/README
+++ b/gitweb/README
@@ -100,13 +100,20 @@ You can specify the following configuration variables when building GIT:
is set when gitweb.cgi is executed, then the file specified in the
environment variable will be loaded instead of the file specified
when gitweb.cgi was created. [Default: gitweb_config.perl]
+ * GITWEB_CONFIG_SYSTEM
+ This Perl file will be loaded using 'do' as a fallback if GITWEB_CONFIG
+ does not exist. If the environment variable GITWEB_CONFIG_SYSTEM is set
+ when gitweb.cgi is executed, then the file specified in the environment
+ variable will be loaded instead of the file specified when gitweb.cgi was
+ created. [Default: /etc/gitweb.conf]
Runtime gitweb configuration
----------------------------
You can adjust gitweb behaviour using the file specified in `GITWEB_CONFIG`
-(defaults to 'gitweb_config.perl' in the same directory as the CGI).
+(defaults to 'gitweb_config.perl' in the same directory as the CGI), and
+as a fallback `GITWEB_CONFIG_SYSTEM` (defaults to /etc/gitweb.conf).
The most notable thing that is not configurable at compile time are the
optional features, stored in the '%features' variable.
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 73d098a433..e69d7fd07b 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -369,7 +369,12 @@ sub filter_snapshot_fmts {
}
our $GITWEB_CONFIG = $ENV{'GITWEB_CONFIG'} || "++GITWEB_CONFIG++";
-do $GITWEB_CONFIG if -e $GITWEB_CONFIG;
+if (-e $GITWEB_CONFIG) {
+ do $GITWEB_CONFIG;
+} else {
+ our $GITWEB_CONFIG_SYSTEM = $ENV{'GITWEB_CONFIG_SYSTEM'} || "++GITWEB_CONFIG_SYSTEM++";
+ do $GITWEB_CONFIG_SYSTEM if -e $GITWEB_CONFIG_SYSTEM;
+}
# version of the core git binary
our $git_version = qx($GIT --version) =~ m/git version (.*)$/ ? $1 : "unknown";