blib/lib/auto/share/dist/Amon2/flavor/Large/script/admin.pl untested

filter: Statementstmt 0.0% 0 / 12 Branchbran n/a Conditioncond 0.0% 0 / 7 MC/DCmcdc 0.0% 0 / 4 Subroutinesub n/a Podpod n/a totaltotal 0.0% 0 / 23 SCAR -
1 %% cascade "Minimum/script/server.pl"
2  
3 %% override load_modules -> {
4 use <% $module %>::Admin;
5 use Plack::App::File;
6 use Plack::Session::Store::DBI;
7 use DBI;
8 %% }
9  
10 %% override app -> {
11 use 5.010_001;
12  
13 my $basedir = File::Spec->rel2abs(dirname(__FILE__));
14 my $app = builder {
15 enable 'Plack::Middleware::Auth::Basic',
16 authenticator => sub { $_[0] eq 'admin' && $_[1] eq 'admin' };
17 enable 'Plack::Middleware::Static',
18 path => qr{^(?:/robots\.txt|/favicon\.ico)$},
19 root => File::Spec->catdir(dirname(__FILE__), '..', 'static', 'admin');
20 enable 'Plack::Middleware::ReverseProxy';
21 enable 'Plack::Middleware::Session',
22 store => Plack::Session::Store::DBI->new(
23 get_dbh => sub {
24 state $db_config = <% $module %>->config->{DBI} || die "Missing configuration for DBI";
25 DBI->connect( @$db_config )
26 or die $DBI::errstr;
27 }
28 );
29  
30 mount '/static/' => Plack::App::File->new(root => File::Spec->catdir($basedir, '..', 'static', 'admin'))->to_app();
31 mount '/' => <% $module %>::Admin->to_app();
32 };
33 %% }