blib/lib/FirewallManager.pm

filter: Statementstmt 33.3% 1 / 3 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 1 / 1 Podpod n/a totaltotal 50.0% 2 / 4 CC 1 SCAR 2.6
CC
1
Cov
33%
BEGIN
1.3
CRAP 1.3
↑ Summary
1 package FirewallManager;
2 0 ▶use Mojo::Base 'Mojolicious';
Subroutine BEGIN: called CC=1 SCAR=2.6
3  
4 use 5.012;
5 use Data::Dumper;
6 use Mojo::Headers;
7  
8 # This method will run once at server start
9 sub startup {
10 my $self = shift;
11  
12 my $db_params = {
13 "dsn" => "DBI:MariaDB:database=eladmin",
14 "username" => "careline",
15 "password" => "Cisc0123",
16 #"options" => { mysql_enable_utf8 => 1 }
17 };
18  
19 my $headers = Mojo::Headers->new;
20 $headers->access_control_allow_origin;
21 # Load configuration from hash returned by config file
22 my $config = $self->plugin('Config');
23 my $api_route = $self->plugin('Crud');
24 $self->plugin( 'DBI', $db_params );
25 $self->plugin( 'CORS' );
26  
27 #say Dumper keys %$self;
28 say Dumper $self->dbi;
29  
30 # Configure the application
31 $self->secrets( $config->{secrets} );
32  
33 # Router
34 my $r = $self->routes;
35 $r->api_routes( { name => "Device" } );
36 $r->api_routes( { name => "Firewall" } );
37  
38 #say Dumper $self->ua;
39 # Normal route to controller
40 #$r->get('/')->to('example#welcome');
41 }
42  
43 1;
↑ Summary