X-Git-Url: http://git.ieval.ro/?a=blobdiff_plain;f=app.psgi;h=80ed1a2268195992ddfb5cc40d35226d8944b356;hb=ea6cce4c6c69f605e069049df4ca72f08451ef95;hp=1181e13d4bf718702fc5b6e31758058e29ddc613;hpb=93c81af3918c6e7478f3340a97ea2f2a3f0dd253;p=gruntmaster-page.git diff --git a/app.psgi b/app.psgi index 1181e13..80ed1a2 100644 --- a/app.psgi +++ b/app.psgi @@ -1,6 +1,6 @@ -#!/usr/bin/perl -w +#!/usr/bin/perl use v5.14; -no if $] >= 5.017011, warnings => 'experimental::smartmatch'; +use warnings; use Gruntmaster::Data; use Plack::App::Gruntmaster; @@ -8,8 +8,6 @@ use Plack::Builder; use Plack::Util; use Log::Log4perl; -use constant AUTH_TIMEOUT => 5 * 60; - sub CONTENT_SECURITY_POLICY () { my $csp = <connect($ENV{GRUNTMASTER_DSN} // 'dbi:Pg:'); - $env->{'gruntmaster.dbic'} = $db; - $app->($env) + dbinit $ENV{GRUNTMASTER_DSN} // 'dbi:Pg:' unless $dbinit; + $dbinit = 1; + $app->(@_) } } @@ -43,7 +40,6 @@ sub add_headers { my $resp = $app->($_[0]); my $hdrs = Plack::Util::headers($resp->[1]); $hdrs->set('Content-Security-Policy', CONTENT_SECURITY_POLICY); - $hdrs->set('Link', '; rel=stylesheet') if $hdrs->get('Content-Type') =~ m,^text/html,; $hdrs->set('Cache-Control', 'public, max-age=604800') if $_[0]->{PATH_INFO} =~ qr,^/static/,; $resp->[1] = $hdrs->headers; $resp;