{"thread":{"id":"675","subject":"add conf file support to gitweb","startedAt":"2005-05-20T19:29:45Z","lastAt":"2005-05-20T19:29:45Z","messageCount":1,"participants":["Andres Salomon"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"3639","messageId":"1116617385.15157.19.camel@jack.dev.in.athenacr.com","threadId":"675","inReplyTo":null,"subject":"add conf file support to gitweb","fromName":"Andres Salomon","fromEmail":"dilinger@athenacr.com","sentAt":"2005-05-20T19:29:45Z","receivedAt":"2005-05-20T19:29:45Z","isPatch":false,"sender":{"key":"dilinger@athenacr.com","avatar":null},"body":"Hi,\n\nThe attached patch makes gitweb read and eval variables from\nan /etc/gitweb.conf file.  This is useful for distributions; I'm\npackaging gitweb for debian, and want to have a separate config file\nthat users can edit that won't get overwritten when they upgrade gitweb.\nEven if you don't take this patch, please consider some other method\nthat decouples the configuration from the gitweb.cgi script.\n\n\n\n\nIndex: gitweb.cgi\n===================================================================\n--- 8b7a4b08ba4892970a2531d4c1584e3881a13586/gitweb.cgi  (mode:100644)\n+++ fe8329b147103e115e2ad727bfca34c2ecfa901d/gitweb.cgi  (mode:100755)\n@@ -40,6 +40,16 @@\n #my $projects_list = $projectroot;\n my $projects_list = \"index/index.aux\";\n \n+# allow config file to override settings above\n+if (-r '/etc/gitweb.conf') {\n+\topen(CONF, '/etc/gitweb.conf') || die_error(undef, \"Cannot open /etc/gitweb.conf.\");\n+\twhile (<CONF>) {\n+\t\tchomp;\n+\t\teval($_) if ($_ =~ /^\\s*(\\$[\\w]+)\\s*=\\s*(.*)\\s*$/);\n+\t}\n+\tclose(CONF);\n+}\n+\n # input validation and dispatch\n my $action = $cgi->param('a');\n if (defined $action) {\n"}]}