]> Sergey Matveev's repositories - public-inbox.git/blob - examples/cgit.psgi
wwwaltid: inform users to use POST instead of GET
[public-inbox.git] / examples / cgit.psgi
1 #!/usr/bin/perl -w
2 # Copyright (C) 2019-2020 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_config = PublicInbox::Config->new;
18 my $cgit = PublicInbox::Cgit->new($pi_config);
19
20 builder {
21         eval {
22                 enable 'Deflater',
23                         content_type => [ qw(
24                                 text/html
25                                 text/plain
26                                 application/atom+xml
27                                 )]
28         };
29         eval { enable 'ReverseProxy' };
30         enable 'Head';
31         sub { $cgit->call($_[0]) }
32 }