From 9f719712492c3d7cdd1eb39ca0224b6cd5a014d8 Mon Sep 17 00:00:00 2001 From: Thomas Bloor Date: Wed, 21 Mar 2018 17:24:13 +0000 Subject: [PATCH] Set secrets with decent default for production --- lib/Pear/LocalLoop.pm | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/Pear/LocalLoop.pm b/lib/Pear/LocalLoop.pm index c996567..db7bba8 100644 --- a/lib/Pear/LocalLoop.pm +++ b/lib/Pear/LocalLoop.pm @@ -34,6 +34,13 @@ sub startup { }); my $config = $self->config; + if ( defined $config->{secret} ) { + $self->secrets([ $config->{secret} ]); + } elsif ( $self->mode eq 'production' ) { + # Just incase we end up in production and it hasnt been set! + $self->secrets([ Data::UUID->new->create() ]); + } + push @{ $self->commands->namespaces }, __PACKAGE__ . '::Command'; $self->plugin('Pear::LocalLoop::Plugin::BootstrapPagination', { bootstrap4 => 1 } ); @@ -247,9 +254,9 @@ sub startup { # $portal_api->post('/search')->to('api-upload#post_search'); $self->hook( before_dispatch => sub { - my $self = shift; + my $c = shift; - $self->res->headers->header('Access-Control-Allow-Origin' => '*') if $self->app->mode eq 'development'; + $c->res->headers->header('Access-Control-Allow-Origin' => '*') if $c->app->mode eq 'development'; }); $self->helper( copy_transactions_and_delete => sub {