move debug configuration into psgi

This commit is contained in:
Graham Knop 2010-04-16 09:06:40 -05:00
parent cd9afc78b9
commit e4a0017ce9
2 changed files with 16 additions and 19 deletions

View file

@ -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);

View file

@ -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;