about summary refs log tree commit homepage
path: root/examples
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2016-12-13 21:56:39 +0000
committerEric Wong <e@80x24.org>2016-12-14 00:22:55 +0000
commit00488f0cfe9f81d04cd65d09ea783e860c937401 (patch)
tree24e4d9282d5e7098fc6cbdcc9d5615c46513661f /examples
parentf9d4f28d9761011d3c7ffad9e2c9d1e54b65c519 (diff)
parent6cdb0221d18b2caed4d0caebf7c20d6eb159497d (diff)
downloadpublic-inbox-00488f0cfe9f81d04cd65d09ea783e860c937401.tar.gz
* origin/repobrowse: (98 commits)
  t/repobrowse_git_httpd.t: ensure signature exists for split
  t/repobrowse_git_tree.t: fix test for lack of bold
  repobrowse: fix alignment of gitlink entries
  repobrowse: show invalid type for tree views
  repobrowse: do not bold directory names in tree view
  repobrowse: reduce checks for response fh
  repobrowse: larger, short-lived buffer for reading patches
  repobrowse: reduce risk of callback reference cycles
  repobrowse: snapshot support for cgit compatibility
  test: disable warning for Plack::Test::Impl
  repobrowse: avoid confusing linkification for "diff"
  repobrowse: git commit view uses pi-httpd.async
  repobrowse: more consistent variable naming for /commit/
  repobrowse: show roughly equivalent "diff-tree" invocation
  repobrowse: reduce local variables for state management
  repobrowse: summary handles multiple README types
  repobrowse: remove bold decorations from diff view
  repobrowse: common git diff parsing code
  repobrowse: implement diff view for compatibility
  examples/repobrowse.psgi: disable Chunked response by default
  ...
Diffstat (limited to 'examples')
-rw-r--r--examples/repobrowse.psgi47
1 files changed, 47 insertions, 0 deletions
diff --git a/examples/repobrowse.psgi b/examples/repobrowse.psgi
new file mode 100644
index 00000000..faf8c331
--- /dev/null
+++ b/examples/repobrowse.psgi
@@ -0,0 +1,47 @@
+#!/usr/bin/perl -w
+# Copyright (C) 2015-2016 all contributors <meta@public-inbox.org>
+# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
+#
+# standalone repobrowse example PSGI
+#
+# Note: this is part of our test suite, update t/*.t if this changes
+# Usage: plackup [OPTIONS] /path/to/this/file
+# A startup command for development which monitors changes:
+#        plackup -I lib -o 127.0.0.1 -R lib -r examples/repobrowse.psgi
+use strict;
+use warnings;
+use PublicInbox::Repobrowse;
+use Plack::Builder;
+my $repobrowse = PublicInbox::Repobrowse->new;
+
+builder {
+        # Chunked middleware conflicts with Starman:
+        # https://github.com/miyagawa/Starman/issues/23
+        # enable 'Chunked';
+        eval {
+                enable 'Deflater',
+                        content_type => [ 'text/html', 'text/plain',
+                                          'application/atom+xml' ];
+        };
+        $@ and warn
+"Plack::Middleware::Deflater missing, bandwidth will be wasted\n";
+
+        # Enable to ensure redirects and Atom feed URLs are generated
+        # properly when running behind a reverse proxy server which
+        # sets X-Forwarded-For and X-Forwarded-Proto request headers.
+        # See Plack::Middleware::ReverseProxy documentation for details
+        eval { enable 'ReverseProxy' };
+        $@ and warn
+"Plack::Middleware::ReverseProxy missing,\n",
+"URL generation for redirects may be wrong if behind a reverse proxy\n";
+
+        # Optional: Log timing information for requests to track performance.
+        # Logging to STDOUT is recommended since public-inbox-httpd knows
+        # how to reopen it via SIGUSR1 after log rotation.
+        # enable 'AccessLog::Timed',
+        #        logger => sub { syswrite(STDOUT, $_[0]) },
+        #        format => '%t "%r" %>s %b %D';
+
+        enable 'Head';
+        sub { $repobrowse->call(@_) }
+}