install.sh: expand @cfg_name@ in processed scripts
[girocco.git] / gitweb / gitweb_config.perl
blobc2ae41e994b61b8a3daf0d062aa12fb85b8b3194
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 # make sure these are available to make this config file "use"able outside
42 # gitweb.cgi -- everything else in this file already has an explicit "our".
43 our %feature;
44 our %html_cache_actions;
46 # rename detection options for git-diff and git-diff-tree (default is '-M')
47 our @diff_opts = ('-B', '-C');
49 # Whether to include project list on the gitweb front page; 0 means yes,
50 # 1 means no list but show tag cloud if enabled (all projects still need
51 # to be scanned, unless the info is cached), 2 means no list and no tag cloud
52 # (very fast)
53 our $frontpage_no_project_list = 1;
55 ## projects list cache for busy sites with many projects;
56 ## if you set this to non-zero, it will be used as the cached
57 ## index lifetime in minutes
58 our $projlist_cache_lifetime = 10;
60 ## default charset for text/plain blob
61 our $default_text_plain_charset = 'utf-8';
63 # Comment out to disable ctags or set to 1 for display only
64 $feature{'ctags'}{'default'}=["@{[url_path($Girocco::Config::webadmurl)]}/tagproj.cgi"];
65 #$feature{'ctags'}{'default'}=[1]; # display-only setting (no add tag box on summary page)
67 $feature{'blame'}{'default'}=[1];
68 $feature{'blame_incremental'}{'default'}=[1];
70 $feature{'snapshot'}{'default'} = ['tgz', 'zip'];
72 # Enable override to turn off snapshots on a per-repository basis with config gitweb.snapshot=none
73 #$feature{'snapshot'}{'override'} = 1;
75 # Change this from 1 to 0 to disable all searching
76 # (it's enabled by default so commenting this out will still leave it enabled)
77 # Note that project-specific override is NOT supported for this option!
78 $feature{'search'}{'default'}=[1];
80 # Change this from 0 to 1 to enable git regular expression searches
81 # (they can be CPU/memory intensive when malicious regular expressions are used)
82 # (they're enabled by default so commenting this out will leave them enabled)
83 $feature{'regexp'}{'default'}=[0];
85 # Enable override to control regexp on a per-repository basis with config gitweb.regexp=<bool>
86 #$feature{'regexp'}{'override'} = 1;
88 # Change this from 0 to 1 to enable grep searches (they can be CPU intensive)
89 # (it's enabled by default so commenting this out will leave it enabled)
90 # Note that it will be automatically disabled if 'search' is disabled.
91 $feature{'grep'}{'default'}=[0];
93 # Enable override to control grep on a per-repository basis with config gitweb.grep=<bool>
94 #$feature{'grep'}{'override'} = 1;
96 # Change this from 0 to 1 to enable pickaxe searches (they can be CPU intensive)
97 # (it's enabled by default so commenting this out will leave it enabled)
98 # Note that it will be automatically disabled if 'search' is disabled.
99 $feature{'pickaxe'}{'default'}=[0];
101 # Enable override to control pickaxe on a per-repository basis with config gitweb.pickaxe=<bool>
102 #$feature{'pickaxe'}{'override'} = 1;
104 # Enable this to highlight sources if highlight is available
105 #$feature{'highlight'}{'default'} = [1];
107 # Set this if highlight is enabled and not available as 'highlight' in $PATH
108 # You should set this to the full absolute path to highlight whenever highlight
109 # cannot be found in any of the `getconf PATH` directories.
110 #our $highlight_bin = "highlight";
112 # the width (in characters) of the projects list "Description" column
113 # (the default is only 25 if this is not set)
114 our $projects_list_description_width = 40;
117 ### You probably don't really want to tweak anything below.
120 # Base web full url
121 our $my_url = $Girocco::Config::gitweburl;
123 # Base web path absolute url except "/" should be ""
124 our $my_uri = url_path($Girocco::Config::gitweburl);
126 # Base web path absolute url
127 our $base_url = url_path($Girocco::Config::gitweburl,1);
129 ## git base URL used for URL to fetch bundle information page
130 ## i.e. full URL is "$git_base_bundles_url/$project/bundles"
131 our $git_base_bundles_url = url_path($Girocco::Config::bundlesurl);
133 # https hint html inserted right after any https push URL (undef for none)
134 # e.g. "<a href="https_push_instructions.html">https push instructions</a>"
135 our $https_hint_html = undef;
136 $https_hint_html = substr(<<HINT,0,-1) if $Girocco::Config::httpspushurl;
137 <sup class="sup"><span><a href="@{[url_path($Girocco::Config::htmlurl)]}/httpspush.html">(learn&#160;more)</a></span></sup>
138 HINT
140 # owner link hook given owner name (full and NOT obfuscated)
141 # should return full URL-escaped link to attach to owner, for example:
142 # sub { return "/showowner.cgi?owner=".CGI::Util::escape($_[0]); }
143 our $owner_link_hook = undef;
144 $owner_link_hook = sub { url_path($Girocco::Config::webadmurl)."/projlist.cgi?name=".md5_hex(lc($_[0])); };
146 # Path to a POSIX shell. Needed to run $highlight_bin and a snapshot compressor.
147 # Only used when highlight is enabled or snapshots with compressors are enabled.
148 our $posix_shell_bin;
149 $posix_shell_bin = $Girocco::Config::posix_sh_bin if $Girocco::Config::posix_sh_bin;
151 ## core git executable to use
152 ## this can just be "git" if your webserver has a sensible PATH
153 our $GIT = $Girocco::Config::git_bin;
155 ## path to automatic README.html utility
156 our $git_automatic_readme_html = $Girocco::Config::basedir . '/bin/run-format-readme.sh';
158 ## absolute fs-path which will be prepended to the project path
159 our $projectroot = $Girocco::Config::reporoot;
161 # source of projects list
162 our $projects_list = $Girocco::Config::projlist_cache_dir."/gitweb.list";
164 ## target of the home link on top of all pages (absolute url)
165 our $home_link = url_path($Girocco::Config::gitweburl,1);
167 ## string of the home link on top of all pages
168 our $home_link_str = $Girocco::Config::name;
170 ## name of your site or organization to appear in page titles
171 ## replace this with something more descriptive for clearer bookmarks
172 our $site_name = $Girocco::Config::title;
174 ## html text to include at home page
175 our $home_text = "$Girocco::Config::basedir/gitweb/indextext.html";
177 ## URI of stylesheets
178 our @stylesheets = ("@{[url_path($Girocco::Config::gitwebfiles)]}/gitweb.css");
180 ## URI of GIT logo (72x27 size)
181 our $logo = "@{[url_path($Girocco::Config::gitwebfiles)]}/git-logo.png";
183 ## URI of GIT favicon, assumed to be image/png type
184 our $favicon = "@{[url_path($Girocco::Config::gitwebfiles)]}/git-favicon.png";
186 ## URI of gitweb.js
187 our $javascript = "@{[url_path($Girocco::Config::gitwebfiles)]}/gitweb.js";
189 ## URL Hints
191 ## Any of the urls in @git_base_url_list, @git_base_mirror_urls or
192 ## @git_base_push_urls may be an array ref instead of a scalar in which
193 ## case ${}[0] is the url and ${}[1] is an html fragment "hint" to display
194 ## right after the URL.
196 ## list of git base URLs used for URL for where to fetch project from,
197 ## i.e. full URL is "$git_base_url/$project"
198 our @git_base_url_list = ();
199 $Girocco::Config::gitpullurl and push @git_base_url_list, $Girocco::Config::gitpullurl;
200 $Girocco::Config::httppullurl and push @git_base_url_list, $Girocco::Config::httppullurl;
202 ## For push projects (a .nofetch file exists OR gitweb.showpush is true)
203 ## @git_base_url_list entries are shown as "mirror URL" and @git_base_push_urls
204 ## are shown as "push URL" and @git_base_mirror_urls are ignored.
205 ## For non-push projects, @git_base_url_list and @git_base_mirror_urls are shown
206 ## as "mirror URL" and @git_base_push_urls are ignored.
208 ## list of extra git base URLs used for mirrors for where to fetch project from,
209 ## i.e. full URL is "$git_base_mirror_url/$project"
210 our @git_base_mirror_urls = ();
211 $Girocco::Config::httpspushurl && $Girocco::Config::httpspushurl ne ($Girocco::Config::httppullurl||'') and
212 push @git_base_mirror_urls, [$Girocco::Config::httpspushurl,
213 "<sup class=\"sup\"><span><a href=\"@{[url_path($Girocco::Config::htmlurl)]}/rootcert.html\">(learn&#160;more)</a></span></sup>"];
214 $Girocco::Config::pushurl && $Girocco::Config::pushurl =~ m|^ssh://|i and
215 push @git_base_mirror_urls, substr($Girocco::Config::pushurl, 0, 6) .
216 'git@' . substr($Girocco::Config::pushurl, 6);
218 ## list of git base URLs used for URL to push project to,
219 ## i.e. full URL is "$git_base_push_url/$project"
220 our @git_base_push_urls = ();
221 $Girocco::Config::pushurl and push @git_base_push_urls, $Girocco::Config::pushurl;
222 $Girocco::Config::httpspushurl and push @git_base_push_urls, $Girocco::Config::httpspushurl;
224 our $cache_grpshared = 1;
225 our $cache_dir = $Girocco::Config::projlist_cache_dir;
227 our $lastactivity_file = "info/lastactivity";
229 $html_cache_actions{'summary'} = 1;
231 our $per_request_config = 0;
233 our $auto_fcgi = 1;
235 $feature{'pathinfo'}{'default'}=[1];
237 $feature{'forks'}{'default'}=[1];
239 $feature{'actions'}{'default'}=[
240 ('graphiclog1', "@{[url_path($Girocco::Config::gitwebfiles)]}/git-browser/by-commit.html?r=%n", 'log'),
241 ('graphiclog2', "@{[url_path($Girocco::Config::gitwebfiles)]}/git-browser/by-date.html?r=%n", 'graphiclog1'),
242 ('edit', "@{[url_path($Girocco::Config::webadmurl)]}/editproj.cgi?name=%e", 'refs'),
243 ('fork', "@{[url_path($Girocco::Config::webadmurl)]}/regproj.cgi?fork=%e", 'edit')
246 # Prevent any fast CGI instance from holding on to a possibly now-invalid
247 # current working directory. The "root" directory will always be valid (or you
248 # have bigger problems) even if it's the "root" of a chroot or other kind of
249 # jail. gitweb.cgi does not need or require any particular cwd to function and
250 # as all "use"s and "require"s that may depend on the current working directory
251 # have already been completed by now it's safe to "cd /" at this point.
252 chdir "/";
254 # Stuff extra Git configuration options into GIT_CONFIG_PARAMETERS
255 # This mirrors what shlib.sh does (mostly)
256 # Only the options that are appropriate for gitweb are included here
257 git_add_config("core.ignoreCase", "false");
258 git_add_config("core.pager", "cat");
259 # see comments in shlib.sh about packedGitWindowSize
260 if ($Girocco::Config::git_no_mmap) {
261 git_add_config("core.packedGitWindowSize", "1m");
262 } else {
263 git_add_config("core.packedGitWindowSize", "32m");
265 git_add_config("core.packedGitLimit", "256m");
266 # We explicitly set core.bigFileThreshold to only 16m as the
267 # actual value is computed and is not available here and should
268 # only affect pack generation. Since gitweb SHOULD NOT be doing
269 # anything that would generate any packs, this value should not
270 # matter. We set it anyway, just in case.
271 git_add_config("core.bigFileThreshold", "16m");
272 git_add_config("gc.auto", "0");
274 # Since we actually want to display "replaced" commits in
275 # gitweb just the same as git-browser does, make sure that
276 # GIT_NO_REPLACE_OBJECTS is NOT set in the environment for gitweb.
277 delete $ENV{'GIT_NO_REPLACE_OBJECTS'};
279 # This should not be needed, but just in case, make the last expression true