move debug configuration into psgi
This commit is contained in:
parent
cd9afc78b9
commit
e4a0017ce9
2 changed files with 16 additions and 19 deletions
|
|
@ -64,28 +64,11 @@ sub call {
|
|||
return [ 500, [ 'Content-Type' => 'text/plain' ], [ 'Internal Server Error' ] ];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# Perhaps I'm being paranoid..
|
||||
weaken $session->{_config};
|
||||
|
||||
my $debug = $self->canShowDebug($env);
|
||||
if ($debug) {
|
||||
$app = Plack::Middleware::StackTrace->wrap($app);
|
||||
$app = Plack::Middleware::Debug->wrap( $app,
|
||||
panels => [
|
||||
'Environment',
|
||||
'Response',
|
||||
'Timer',
|
||||
'Memory',
|
||||
'Session',
|
||||
'PerlConfig',
|
||||
[ 'MySQLTrace', skip_packages => qr/\AWebGUI::SQL(?:\z|::)/ ],
|
||||
'Response',
|
||||
'Logger',
|
||||
sub { WebGUI::Middleware::Debug::Performance->wrap($_[0]) },
|
||||
],
|
||||
);
|
||||
}
|
||||
my $debug = $env->{'webgui.debug'} = $self->canShowDebug($env);
|
||||
|
||||
# Turn exceptions into HTTP errors
|
||||
$app = WebGUI::Middleware::HTTPExceptions->wrap($app);
|
||||
|
|
|
|||
|
|
@ -25,6 +25,20 @@ builder {
|
|||
config => $config,
|
||||
error_docs => { 500 => $config->get('maintenancePage') };
|
||||
|
||||
enable_if { $_[0]->{'webgui.debug'} } 'StackTrace';
|
||||
enable_if { $_[0]->{'webgui.debug'} } 'Debug', panels => [
|
||||
'Environment',
|
||||
'Response',
|
||||
'Timer',
|
||||
'Memory',
|
||||
'Session',
|
||||
'PerlConfig',
|
||||
[ 'MySQLTrace', skip_packages => qr/\AWebGUI::SQL(?:\z|::)/ ],
|
||||
'Response',
|
||||
'Logger',
|
||||
sub { WebGUI::Middleware::Debug::Performance->wrap($_[0]) },
|
||||
];
|
||||
|
||||
# This one uses the Session object, so it comes after WebGUI::Middleware::Session
|
||||
enable '+WebGUI::Middleware::WGAccess', config => $config;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue