-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.psgi
executable file
·73 lines (56 loc) · 1.37 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/usr/bin/env perl
use strict;
use warnings;
BEGIN {
if ($ENV{_} and $ENV{_} =~ m/netdisco-web-fg$/) {
die "You probably want: '~/bin/localenv starman $0 --workers=1 --disable-keepalive'\n";
}
}
use FindBin;
FindBin::again();
use Path::Class 'dir';
BEGIN {
# stuff useful locations into @INC
unshift @INC,
dir($FindBin::RealBin)->parent->subdir('lib')->stringify,
dir($FindBin::RealBin, 'lib')->stringify;
unshift @INC,
split m/:/, ($ENV{NETDISCO_INC} || '');
}
use App::Netdisco;
use Dancer;
BEGIN {
warning sprintf "App::Netdisco %s web", ($App::Netdisco::VERSION || 'HEAD');
}
set plack_middlewares => [
['Plack::Middleware::ReverseProxy'],
[ Expires => (
content_type => [qr{^application/javascript}, qr{^text/css}, qr{image}, qr{font}],
expires => 'access plus 1 day',
)],
[ Static => (
path => qr{^/(?:javascripts|css|font|images)/},
root => $ENV{DANCER_PUBLIC},
pass_through => 1,
)],
# install Dancer::Debug for this...
(
$ENV{DANCER_DEBUG} ?
[ Debug => (
panels => [qw/Dancer::Settings Parameters Dancer::Version DBITrace/],
)]
: ()
)
];
use App::Netdisco::Web;
use Plack::Builder;
my $path = (setting('path') || '/');
builder { mount $path => dance };
=head1 NAME
netdisco-web-fg - Web Application for Netdisco
=head1 SEE ALSO
=over 4
=item *
L<App::Netdisco>
=back
=cut