#!/usr/bin/env perl
BEGIN {
if
(
$ENV
{_} and
$ENV
{_} =~ m/netdisco-web-fg$/) {
die
"You probably want: '~/bin/localenv starman $0 --workers=1 --disable-keepalive'\n"
;
}
}
FindBin::again();
BEGIN {
unshift
@INC
,
dir(
$FindBin::RealBin
)->parent->subdir(
'lib'
)->stringify,
dir(
$FindBin::RealBin
,
'lib'
)->stringify;
unshift
@INC
,
split
m/:/, (
$ENV
{NETDISCO_INC} ||
''
);
}
BEGIN {
warning
sprintf
"App::Netdisco %s web"
, (
$App::Netdisco::VERSION
||
'HEAD'
);
}
set
plack_middlewares
=> [
[
'Plack::Middleware::ReverseProxy'
],
[
Headers
=> (
set
=> [
'X-Frame-Options'
=> setting(
'HTTP-Header-X-Frame-Options'
)],
)],
[
Headers
=> (
set
=> [
'Content-Security-Policy'
=> setting(
'HTTP-Header-Content-Security-Policy'
)],
)],
[
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,
)],
(
$ENV
{DANCER_DEBUG} ?
[
Debug
=> (
panels
=> [
qw/Dancer::Settings Parameters Dancer::Version DBITrace/
],
)]
: ()
)
];
my
$path
= (setting(
'path'
) ||
'/'
);
builder { mount
$path
=> dance };