# add conf file support to gitweb

1 messages from 2005-05-20 to 2005-05-20. Participants: Andres Salomon.
Thread: https://gitlist.dev/t/675

## Andres Salomon, 2005-05-20 19:29

Subject: add conf file support to gitweb
Message-ID: <1116617385.15157.19.camel@jack.dev.in.athenacr.com>
URL: https://gitlist.dev/e/1116617385.15157.19.camel%40jack.dev.in.athenacr.com

```
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.




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) {

```
