Git development
 help / color / mirror / Atom feed
* add conf file support to gitweb
@ 2005-05-20 19:29 Andres Salomon
  0 siblings, 0 replies; only message in thread
From: Andres Salomon @ 2005-05-20 19:29 UTC (permalink / raw)
  To: git, Kay Sievers

[-- Attachment #1: Type: text/plain, Size: 405 bytes --]

Hi,

The attached patch makes gitweb read and eval variables from
an /etc/gitweb.conf file.  This is useful for distributions; I'm
packaging gitweb for debian, and want to have a separate config file
that users can edit that won't get overwritten when they upgrade gitweb.
Even if you don't take this patch, please consider some other method
that decouples the configuration from the gitweb.cgi script.



[-- Attachment #2: gitweb.conf.patch --]
[-- Type: text/x-patch, Size: 687 bytes --]

Index: gitweb.cgi
===================================================================
--- 8b7a4b08ba4892970a2531d4c1584e3881a13586/gitweb.cgi  (mode:100644)
+++ fe8329b147103e115e2ad727bfca34c2ecfa901d/gitweb.cgi  (mode:100755)
@@ -40,6 +40,16 @@
 #my $projects_list = $projectroot;
 my $projects_list = "index/index.aux";
 
+# allow config file to override settings above
+if (-r '/etc/gitweb.conf') {
+	open(CONF, '/etc/gitweb.conf') || die_error(undef, "Cannot open /etc/gitweb.conf.");
+	while (<CONF>) {
+		chomp;
+		eval($_) if ($_ =~ /^\s*(\$[\w]+)\s*=\s*(.*)\s*$/);
+	}
+	close(CONF);
+}
+
 # input validation and dispatch
 my $action = $cgi->param('a');
 if (defined $action) {

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-05-20 19:28 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-20 19:29 add conf file support to gitweb Andres Salomon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox