admins.html: simplify Libera.Chat URL
[girocco.git] / gitweb / gitweb_config.perl
blob07d112bb3a6f288a6d4d0302b3f6ba3730b7006e
1 # Pull Girocco config
2 use lib "__BASEDIR__";
3 use Girocco::Config;
4 use Girocco::Util qw(url_path git_add_config);
5 use Digest::MD5 qw(md5_hex);
6 BEGIN {
7 eval { require HTML::Email::Obfuscate; 1 } or
8 eval {
9 require Girocco::Email::Obfuscate;
10 $INC{'HTML/Email/Obfuscate.pm'} = $INC{'Girocco/Email/Obfuscate.pm'}; # mwahaha
13 BEGIN {
14 # Redirect use of the FCGI/CGI::Fast module to the pure Perl substitute
15 # unless both the FCGI and CGI::Fast modules are actually present.
16 # However, if one or both of FCGI/CGI::Fast has already been use'd don't
17 # bother doing anything since it's too late to redirect at that point.
18 my $hasinc = sub {
19 do {my $f = $_."/".$_[0]; return $f if -f $f}
20 foreach grep(!ref($_),@INC);
21 return undef;
23 my $gd = sub {my $l=1; return sub {$_=$l?"1;":"";$l--}};
24 my $pre = sub {
25 if ($_[1] eq 'CGI/Fast.pm' && !$INC{'FCGI.pm'} or
26 $_[1] eq 'FCGI.pm' && !$INC{'CGI/Fast.pm'}) {
27 if (!&$hasinc('CGI/Fast.pm') || !&$hasinc('FCGI.pm')) {
28 require 'Girocco/extra/CGI/FCGI.pm';
29 return &$gd;
32 return ();
34 unshift(@INC, $pre);
37 ## For the complete overview of available configuration options,
38 ## see git.git/gitweb/gitweb.perl file beginning (git.git/gitweb/README
39 ## may miss some custom patches, in theory).
41 # rename detection options for git-diff and git-diff-tree (default is '-M')
42 our @diff_opts = ('-B', '-C');
44 # Whether to include project list on the gitweb front page; 0 means yes,
45 # 1 means no list but show tag cloud if enabled (all projects still need
46 # to be scanned, unless the info is cached), 2 means no list and no tag cloud
47 # (very fast)
48 our $frontpage_no_project_list = 1;
50 ## projects list cache for busy sites with many projects;
51 ## if you set this to non-zero, it will be used as the cached
52 ## index lifetime in minutes
53 our $projlist_cache_lifetime = 525600; # 1y
55 ## default charset for text/plain blob
56 our $default_text_plain_charset = 'utf-8';
58 # Comment out to disable ctags or set to 1 for display only
59 $feature{'ctags'}{'default'}=["@{[url_path($Girocco::Config::webadmurl)]}/tagproj.cgi"];
60 #$feature{'ctags'}{'default'}=[1]; # display-only setting (no add tag box on summary page)
62 $feature{'blame'}{'default'}=[1];
63 $feature{'blame_incremental'}{'default'}=[1];
65 $feature{'snapshot'}{'default'} = ['tgz', 'zip'];
67 # Enable override to turn off snapshots on a per-repository basis with config gitweb.snapshot=none
68 $feature{'snapshot'}{'override'} = 1;
70 # Change this from 1 to 0 to disable all searching
71 # (it's enabled by default so commenting this out will still leave it enabled)
72 # Note that project-specific override is NOT supported for this option!
73 $feature{'search'}{'default'}=[1];
75 # Change this from 0 to 1 to enable git regular expression searches
76 # (they can be CPU/memory intensive when malicious regular expressions are used)
77 # (they're enabled by default so commenting this out will leave them enabled)
78 $feature{'regexp'}{'default'}=[0];
80 # Enable override to control regexp on a per-repository basis with config gitweb.regexp=<bool>
81 #$feature{'regexp'}{'override'} = 1;
83 # Change this from 0 to 1 to enable grep searches (they can be CPU intensive)
84 # (it's enabled by default so commenting this out will leave it enabled)
85 # Note that it will be automatically disabled if 'search' is disabled.
86 $feature{'grep'}{'default'}=[0];
88 # Enable override to control grep on a per-repository basis with config gitweb.grep=<bool>
89 #$feature{'grep'}{'override'} = 1;
91 # Change this from 0 to 1 to enable pickaxe searches (they can be CPU intensive)
92 # (it's enabled by default so commenting this out will leave it enabled)
93 # Note that it will be automatically disabled if 'search' is disabled.
94 $feature{'pickaxe'}{'default'}=[0];
96 # Enable override to control pickaxe on a per-repository basis with config gitweb.pickaxe=<bool>
97 #$feature{'pickaxe'}{'override'} = 1;
99 # Enable this to highlight sources if highlight is available
100 $feature{'highlight'}{'default'} = [1];
102 # Set this if highlight is enabled and not available as 'highlight' in $PATH
103 # You should set this to the full absolute path to highlight whenever highlight
104 # cannot be found in any of the `getconf PATH` directories.
105 #our $highlight_bin = "highlight";
107 # the width (in characters) of the projects list "Description" column
108 # (the default is only 25 if this is not set)
109 our $projects_list_description_width = 40;
112 ### You probably don't really want to tweak anything below.
115 # Base web full url
116 our $my_url = $Girocco::Config::gitweburl;
118 # Base web path absolute url except "/" should be ""
119 our $my_uri = url_path($Girocco::Config::gitweburl);
121 # Base web path absolute url
122 our $base_url = url_path($Girocco::Config::gitweburl,1);
124 ## git base URL used for URL to fetch bundle information page
125 ## i.e. full URL is "$git_base_bundles_url/$project/bundles"
126 our $git_base_bundles_url = url_path($Girocco::Config::bundlesurl);
128 # https hint html inserted right after any https push URL (undef for none)
129 # e.g. "<a href="https_push_instructions.html">https push instructions</a>"
130 our $https_hint_html = undef;
131 $https_hint_html = substr(<<HINT,0,-1) if $Girocco::Config::httpspushurl;
132 <sup class="sup"><span><a href="@{[url_path($Girocco::Config::htmlurl)]}/httpspush.html">(learn&#160;more)</a></span></sup>
133 HINT
135 # owner link hook given owner name (full and NOT obfuscated)
136 # should return full URL-escaped link to attach to owner, for example:
137 # sub { return "/showowner.cgi?owner=".CGI::Util::escape($_[0]); }
138 our $owner_link_hook = undef;
139 $owner_link_hook = sub { url_path($Girocco::Config::webadmurl)."/projlist.cgi?name=".md5_hex(lc($_[0])); };
141 # Path to a POSIX shell. Needed to run $highlight_bin and a snapshot compressor.
142 # Only used when highlight is enabled or snapshots with compressors are enabled.
143 our $posix_shell_bin;
144 $posix_shell_bin = $Girocco::Config::posix_sh_bin if $Girocco::Config::posix_sh_bin;
146 ## core git executable to use
147 ## this can just be "git" if your webserver has a sensible PATH
148 our $GIT = $Girocco::Config::git_bin;
150 ## path to automatic README.html utility
151 our $git_automatic_readme_html = $Girocco::Config::basedir . '/bin/run-format-readme.sh';
153 ## absolute fs-path which will be prepended to the project path
154 our $projectroot = $Girocco::Config::reporoot;
156 # source of projects list
157 our $projects_list = $Girocco::Config::projlist_cache_dir."/gitweb.list";
159 ## target of the home link on top of all pages (absolute url)
160 our $home_link = url_path($Girocco::Config::gitweburl,1);
162 ## string of the home link on top of all pages
163 our $home_link_str = $Girocco::Config::name;
165 ## name of your site or organization to appear in page titles
166 ## replace this with something more descriptive for clearer bookmarks
167 our $site_name = $Girocco::Config::title;
169 ## html text to include at home page
170 our $home_text = "$Girocco::Config::basedir/gitweb/indextext.html";
172 ## URI of stylesheets
173 our @stylesheets = ("@{[url_path($Girocco::Config::gitwebfiles)]}/gitweb.css");
175 ## URI of GIT logo (72x27 size)
176 our $logo = "@{[url_path($Girocco::Config::gitwebfiles)]}/git-logo.png";
178 ## URI of GIT favicon, assumed to be image/png type
179 our $favicon = "@{[url_path($Girocco::Config::gitwebfiles)]}/git-favicon.png";
181 ## URI of gitweb.js
182 our $javascript = "@{[url_path($Girocco::Config::gitwebfiles)]}/gitweb.js";
184 ## URL Hints
186 ## Any of the urls in @git_base_url_list, @git_base_mirror_urls or
187 ## @git_base_push_urls may be an array ref instead of a scalar in which
188 ## case ${}[0] is the url and ${}[1] is an html fragment "hint" to display
189 ## right after the URL.
191 ## list of git base URLs used for URL for where to fetch project from,
192 ## i.e. full URL is "$git_base_url/$project"
193 our @git_base_url_list = ();
194 $Girocco::Config::gitpullurl and push @git_base_url_list, $Girocco::Config::gitpullurl;
195 $Girocco::Config::httppullurl and push @git_base_url_list, $Girocco::Config::httppullurl;
197 ## For push projects (a .nofetch file exists OR gitweb.showpush is true)
198 ## @git_base_url_list entries are shown as "mirror URL" and @git_base_push_urls
199 ## are shown as "push URL" and @git_base_mirror_urls are ignored.
200 ## For non-push projects, @git_base_url_list and @git_base_mirror_urls are shown
201 ## as "mirror URL" and @git_base_push_urls are ignored.
203 ## list of extra git base URLs used for mirrors for where to fetch project from,
204 ## i.e. full URL is "$git_base_mirror_url/$project"
205 our @git_base_mirror_urls = ();
206 $Girocco::Config::httpspushurl && $Girocco::Config::httpspushurl ne ($Girocco::Config::httppullurl||'') and
207 push @git_base_mirror_urls, [$Girocco::Config::httpspushurl,
208 "<sup class=\"sup\"><span><a href=\"@{[url_path($Girocco::Config::htmlurl)]}/rootcert.html\">(learn&#160;more)</a></span></sup>"];
209 $Girocco::Config::pushurl && $Girocco::Config::pushurl =~ m|^ssh://|i and
210 push @git_base_mirror_urls, substr($Girocco::Config::pushurl, 0, 6) .
211 'git@' . substr($Girocco::Config::pushurl, 6);
213 ## list of git base URLs used for URL to push project to,
214 ## i.e. full URL is "$git_base_push_url/$project"
215 our @git_base_push_urls = ();
216 $Girocco::Config::pushurl and push @git_base_push_urls, $Girocco::Config::pushurl;
217 $Girocco::Config::httpspushurl and push @git_base_push_urls, $Girocco::Config::httpspushurl;
219 our $cache_grpshared = 1;
220 our $cache_dir = $Girocco::Config::projlist_cache_dir;
222 our $lastactivity_file = "info/lastactivity";
224 $html_cache_actions{'summary'} = 1;
226 our $per_request_config = 0;
228 our $auto_fcgi = 1;
230 $feature{'pathinfo'}{'default'}=[1];
232 $feature{'forks'}{'default'}=[1];
234 $feature{'actions'}{'default'}=[
235 ('graphiclog1', "@{[url_path($Girocco::Config::gitwebfiles)]}/git-browser/by-commit.html?r=%n", 'log'),
236 ('graphiclog2', "@{[url_path($Girocco::Config::gitwebfiles)]}/git-browser/by-date.html?r=%n", 'graphiclog1'),
237 ('edit', "@{[url_path($Girocco::Config::webadmurl)]}/editproj.cgi?name=%e", 'refs'),
238 ('fork', "@{[url_path($Girocco::Config::webadmurl)]}/regproj.cgi?fork=%e", 'edit')
241 # Prevent any fast CGI instance from holding on to a possibly now-invalid
242 # current working directory. The "root" directory will always be valid (or you
243 # have bigger problems) even if it's the "root" of a chroot or other kind of
244 # jail. gitweb.cgi does not need or require any particular cwd to function and
245 # as all "use"s and "require"s that may depend on the current working directory
246 # have already been completed by now it's safe to "cd /" at this point.
247 chdir "/";
249 # Stuff extra Git configuration options into GIT_CONFIG_PARAMETERS
250 # This mirrors what shlib.sh does (mostly)
251 # Only the options that are appropriate for gitweb are included here
252 git_add_config("core.ignoreCase", "false");
253 git_add_config("core.pager", "cat");
254 # see comments in shlib.sh about packedGitWindowSize
255 if ($Girocco::Config::git_no_mmap) {
256 git_add_config("core.packedGitWindowSize", "1m");
257 } else {
258 git_add_config("core.packedGitWindowSize", "32m");
260 git_add_config("core.packedGitLimit", "256m");
261 # We explicitly set core.bigFileThreshold to only 16m as the
262 # actual value is computed and is not available here and should
263 # only affect pack generation. Since gitweb SHOULD NOT be doing
264 # anything that would generate any packs, this value should not
265 # matter. We set it anyway, just in case.
266 git_add_config("core.bigFileThreshold", "16m");
267 git_add_config("gc.auto", "0");
269 # Since we actually want to display "replaced" commits in
270 # gitweb just the same as git-browser does, make sure that
271 # GIT_NO_REPLACE_OBJECTS is NOT set in the environment for gitweb.
272 delete $ENV{'GIT_NO_REPLACE_OBJECTS'};
274 # This should not be needed, but just in case, make the last expression true