-
Notifications
You must be signed in to change notification settings - Fork 1
/
app.psgi
39 lines (37 loc) · 1.12 KB
/
app.psgi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
use strict;
use utf8;
use File::Spec;
use File::Basename;
use lib File::Spec->catdir(dirname(__FILE__), 'extlib', 'lib', 'perl5');
use lib File::Spec->catdir(dirname(__FILE__), 'lib');
use Plack::Builder;
use EDAMSync::Web;
use EDAMSync;
use Plack::Session::Store::DBI;
use Plack::Session::State::Cookie;
use DBI;
{
my $c = EDAMSync->new();
$c->setup_schema();
}
my $db_config = EDAMSync->config->{DBI} || die "Missing configuration for DBI";
builder {
enable 'Plack::Middleware::Static',
path => qr{^(?:/static/)},
root => File::Spec->catdir(dirname(__FILE__));
enable 'Plack::Middleware::Static',
path => qr{^(?:/robots\.txt|/favicon\.ico)$},
root => File::Spec->catdir(dirname(__FILE__), 'static');
enable 'Plack::Middleware::ReverseProxy';
enable 'Plack::Middleware::Session',
store => Plack::Session::Store::DBI->new(
get_dbh => sub {
DBI->connect( @$db_config )
or die $DBI::errstr;
}
),
state => Plack::Session::State::Cookie->new(
httponly => 1,
);
EDAMSync::Web->to_app();
};