From 1cd463434aa1578cbff6c4bfd44f794fbfce4153 Mon Sep 17 00:00:00 2001 From: Sergiotarxz Date: Sat, 2 Nov 2024 21:27:23 +0100 Subject: [PATCH] Adding listen shortcut. --- lib/MakeThemPay.pm | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/lib/MakeThemPay.pm b/lib/MakeThemPay.pm index 35c9aae..e84de01 100644 --- a/lib/MakeThemPay.pm +++ b/lib/MakeThemPay.pm @@ -4,19 +4,25 @@ use Mojo::Base 'Mojolicious', -signatures; # This method will run once at server start sub startup ($self) { - # Load configuration from config file - my $config = $self->plugin('NotYAMLConfig'); + # Load configuration from config file + my $config = $self->plugin('NotYAMLConfig'); + $self->config( + hypnotoad => { + proxy => 1, + listen => [ $self->config('listen') // 'http://localhost:3000' ] + } + ); - # Configure the application - $self->secrets($config->{secrets}); + # Configure the application + $self->secrets( $config->{secrets} ); - # Router - my $r = $self->routes; + # Router + my $r = $self->routes; - # Normal route to controller - $r->get('/get_pay_url/:uuid')->to('Main#get_url'); - $r->get('/set_paid/:uuid')->to('Main#set_paid'); - $r->get('/get_paid/:uuid')->to('Main#get_paid'); + # Normal route to controller + $r->get('/get_pay_url/:uuid')->to('Main#get_url'); + $r->get('/set_paid/:uuid')->to('Main#set_paid'); + $r->get('/get_paid/:uuid')->to('Main#get_paid'); } 1;