]> Sergey Matveev's repositories - public-inbox.git/commitdiff
httpd: avoid loading our WWW-specific code early
authorEric Wong <e@80x24.org>
Fri, 26 Feb 2016 03:51:47 +0000 (03:51 +0000)
committerEric Wong <e@80x24.org>
Fri, 26 Feb 2016 03:54:03 +0000 (03:54 +0000)
We want this to be usable as a generic httpd for other Free Software
projects, so do not force users to load our WWW code at
compile-time.

public-inbox-httpd

index 772333e8b0a49a084f14853c6ae9c5a27796473f..b871e3de067353f84b210c2fc1f1948e665783f1 100644 (file)
@@ -8,13 +8,9 @@ use warnings;
 use Plack::Util;
 use PublicInbox::Daemon;
 use PublicInbox::HTTP;
-use PublicInbox::WWW;
 use Plack::Request;
 use Plack::Builder;
-PublicInbox::WWW->preload;
-my $have_deflater = eval { require Plack::Middleware::Deflater; 1 };
 my %httpds;
-my $config;
 my $app;
 my $refresh = sub {
        if (@ARGV) {
@@ -24,6 +20,8 @@ my $refresh = sub {
 "$0 runs in /, command-line paths must be absolute\n";
                }
        } else {
+               require PublicInbox::WWW;
+               PublicInbox::WWW->preload;
                my $www = PublicInbox::WWW->new;
                $app = eval {
                        my $deflate_types = eval {