1#!/usr/bin/env perl 2 3use strict; 4use warnings; 5 6BEGIN { 7 if ($ENV{_} and $ENV{_} =~ m/netdisco-web-fg$/) { 8 die "You probably want: '~/bin/localenv starman $0 --workers=1 --disable-keepalive'\n"; 9 } 10} 11 12use FindBin; 13FindBin::again(); 14use Path::Class 'dir'; 15 16BEGIN { 17 # stuff useful locations into @INC 18 unshift @INC, 19 dir($FindBin::RealBin)->parent->subdir('lib')->stringify, 20 dir($FindBin::RealBin, 'lib')->stringify; 21 22 unshift @INC, 23 split m/:/, ($ENV{NETDISCO_INC} || ''); 24} 25 26use App::Netdisco; 27use Dancer; 28BEGIN { 29 warning sprintf "App::Netdisco %s web", ($App::Netdisco::VERSION || 'HEAD'); 30} 31 32set plack_middlewares => [ 33 ['Plack::Middleware::ReverseProxy'], 34 [ Expires => ( 35 content_type => [qr{^application/javascript}, qr{^text/css}, qr{image}, qr{font}], 36 expires => 'access plus 1 day', 37 )], 38 [ Static => ( 39 path => qr{^/(?:javascripts|css|font|images)/}, 40 root => $ENV{DANCER_PUBLIC}, 41 pass_through => 1, 42 )], 43 # install Dancer::Debug for this... 44 ( 45 $ENV{DANCER_DEBUG} ? 46 [ Debug => ( 47 panels => [qw/Dancer::Settings Parameters Dancer::Version DBITrace/], 48 )] 49 : () 50 ) 51]; 52 53use App::Netdisco::Web; 54use Plack::Builder; 55 56my $path = (setting('path') || '/'); 57builder { mount $path => dance }; 58 59=head1 NAME 60 61netdisco-web-fg - Web Application for Netdisco 62 63=head1 SEE ALSO 64 65=over 4 66 67=item * 68 69L<App::Netdisco> 70 71=back 72 73=cut 74