]> Sergey Matveev's repositories - public-inbox.git/blob - examples/cgit.psgi
recv_cmd: do not undef recvmsg buffer arg on errors
[public-inbox.git] / examples / cgit.psgi
1 #!/usr/bin/perl -w
2 # Copyright (C) 2019-2021 all contributors <meta@public-inbox.org>
3 # License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
4 #
5 # PublicInbox::Cgit may be used independently of WWW.
6 #
7 # Usage (development, with auto-reload):
8 #       plackup -I lib -o 127.0.0.1 -R lib -r examples/cgit.psgi
9 #
10 # Usage (production, with public-inbox-httpd(1)):
11 #       public-inbox-httpd [OPTIONS] /path/to/examples/cgit.psgi
12 use strict;
13 use warnings;
14 use Plack::Builder;
15 use PublicInbox::Cgit;
16 use PublicInbox::Config;
17 my $pi_cfg = PublicInbox::Config->new;
18 my $cgit = PublicInbox::Cgit->new($pi_cfg);
19
20 builder {
21         eval { enable 'ReverseProxy' };
22         enable 'Head';
23         sub { $cgit->call($_[0]) }
24 }