summary refs log tree commit diff
path: root/lib/Plack/Middleware/Debug/Dancer/Settings.pm
blob: 07ed96ca7b817cb5d8946bed9a2ff5f2e1aa9b75 (plain) (blame)
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
package Plack::Middleware::Debug::Dancer::Settings;

# ABSTRACT: Settings panel of your Dancer's application

use strict;
use warnings;
use parent qw(Plack::Middleware::Debug::Base);
use Class::Method::Modifiers qw/install_modifier/;
use Dancer::Config;

sub run {
    my ( $self, $env, $panel ) = @_;

    return sub {
        my $res = shift;
        my $settings = Dancer::Config->settings();
        $panel->title('Dancer::Settings');
        $panel->nav_subtitle('Dancer::Settings');
        my @settings = map { $_ => $settings->{$_}} keys %$settings;
        $panel->content( sub { $self->render_list_pairs( \@settings ) } );
    };
}

1;

=head1 SYNOPSIS

To activate this panel:

    plack_middlewares:
      Debug:
        - panels
        -
          - Dancer::Settings