git/list[1] front-page[2] threads[3] people[4] search[5] about
 

add conf file support to gitweb

From
ASAndres Salomon <dilinger@athenacr.com>
Date
May 20, 2005, 19:29 UTC
Message-ID
<1116617385.15157.19.camel@jack.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) {
Message 1 of 1 in “add conf file support to gitweb”
  1. Andres SalomonMay 20, 2005

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.