X-Git-Url: http://git.ieval.ro/?a=blobdiff_plain;f=app.psgi;h=a13a73e4965ba82ca2d26b8a40a8c094d2bb3094;hb=21dc66dbe148a63d1e056e3b3c03933889392fc2;hp=290ef4b5fb4d41e145032d7fc81599ba03fc889e;hpb=bd623b0d48dd6a43d140e8c0af0be975fdee2656;p=gruntmaster-page.git diff --git a/app.psgi b/app.psgi index 290ef4b..a13a73e 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,9 +8,6 @@ use Plack::Builder; use Plack::Util; use Log::Log4perl; -use constant AUTH_TIMEOUT => 5 * 60; -use constant ACCESSLOG_FORMAT => '%{X-Forwarded-For}i %l %u %t "%r" %>s %b "%{Referer}i" "%{User-agent}i"'; - sub CONTENT_SECURITY_POLICY () { my $csp = <($_[0]); my $hdrs = Plack::Util::headers($resp->[1]); $hdrs->set('Content-Security-Policy', CONTENT_SECURITY_POLICY); - $hdrs->set('Cache-Control', 'public, max-age=604800') if $_[0]->{PATH_INFO} =~ qr,^/static/,; $resp->[1] = $hdrs->headers; $resp; } } Log::Log4perl->init_once('log.conf'); -my $access_logger = Log::Log4perl->get_logger('access'); $ENV{DBIC_NULLABLE_KEY_NOWARN} = 1; builder { enable_if { $_[0]->{PATH_INFO} eq '/ok' } sub { sub{ [200, [], []] }}; - enable 'AccessLog', format => ACCESSLOG_FORMAT, logger => sub { $access_logger->info(@_) }; enable 'ContentLength'; enable \&add_headers; - enable 'Static', path => qr,^/static/,; enable 'Log4perl', category => 'plack'; enable \&add_database; enable '+Plack::App::Gruntmaster::Auth',