summaryrefslogtreecommitdiff
path: root/templates/gitweb.conf.erb
blob: 7774ed2c81a999585c1682c51dea4904f28227bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# path to git projects (<project>.git)
$projectroot = "<%= project_root %>";

# directory to use for temp files
$git_temp = "/tmp";

# target of the home link on top of all pages
#$home_link = $my_uri || "/";

# html text to include at home page
$home_text = "indextext.html";

# file with project list; by default, simply scan the projectroot dir.
$projects_list = $projectroot;

# stylesheet to use
$stylesheet = "/gitweb.css";

# logo to use
$logo = "/git-logo.png";

# the 'favicon'
$favicon = "/git-favicon.png";

# --------------------------------------------
# Per-repo authorization based on gitolite ACL
# Include this in gitweb.conf
# See doc/3-faq-tips-etc.mkd for more info

# HOME of the gitolite user
my $gl_home = $ENV{HOME} = "/home/git";

# the following variables are needed by gitolite; please edit before using

# this should normally not be anything else
$ENV{GL_RC} = "$gl_home/.gitolite.rc";
# this can have different values depending on how you installed.

$ENV{GL_BINDIR} = "/usr/share/gitolite";
# If in doubt take a look at ~/.ssh/authorized_keys; at least one of the lines
# might contain something like:
#       command="/home/git/.gitolite/src/gl-auth-command
# and you should use whatever directory the gl-auth-command is in (in this
# example /home/git/.gitolite.src)

# finally the user name
$ENV{GL_USER} = $cgi->remote_user || "gitweb";

# now get gitolite stuff in...
unshift @INC, $ENV{GL_BINDIR};
#require gitolite_rc;    gitolite_rc -> import;
require gitolite;       gitolite    -> import;

# set project root etc. absolute paths
$ENV{GL_REPO_BASE_ABS} = $projectroot;

$export_auth_hook = sub {
    my $repo = shift;
    # gitweb passes us the full repo path; so we strip the beginning
    # and the end, to get the repo name as it is specified in gitolite conf
    return unless $repo =~ s!^\Q<%= project_root %>\E\/?(.+)\.git$!$1!;

    # check for (at least) "R" permission
    my ($perm, $creator) = &repo_rights($repo);
    return ($perm =~ /R/);
};