From 236d52714d0ec3495e28038975cdbdabcd9193af Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Sat, 21 Nov 2015 22:43:06 +0000 Subject: [PATCH] Stop calling the env function in naughty places --- app/Composers/AppComposer.php | 1 + .../Events/Incident/SendIncidentEmailNotificationHandler.php | 1 - .../Events/Incident/SendMaintenanceEmailNotificationHandler.php | 1 - .../Subscriber/SendSubscriberVerificationEmailHandler.php | 1 - app/Handlers/Events/User/SendInviteUserEmailHandler.php | 1 - app/Providers/ConfigServiceProvider.php | 2 +- 6 files changed, 2 insertions(+), 5 deletions(-) diff --git a/app/Composers/AppComposer.php b/app/Composers/AppComposer.php index 5a1679c7..f8a63f64 100644 --- a/app/Composers/AppComposer.php +++ b/app/Composers/AppComposer.php @@ -35,6 +35,7 @@ class AppComposer $view->withAppBannerType(Setting::get('app_banner_type')); $view->withAppDomain(Setting::get('app_domain')); $view->withAppName(Setting::get('app_name')); + $view->withAppUrl(Config::get('app.url')); $view->withShowSupport(Setting::get('show_support')); $view->withSubscribersEnabled($isEnabled && $mailAddress && $mailFrom); } diff --git a/app/Handlers/Events/Incident/SendIncidentEmailNotificationHandler.php b/app/Handlers/Events/Incident/SendIncidentEmailNotificationHandler.php index a5f09cbd..6e8ed357 100644 --- a/app/Handlers/Events/Incident/SendIncidentEmailNotificationHandler.php +++ b/app/Handlers/Events/Incident/SendIncidentEmailNotificationHandler.php @@ -76,7 +76,6 @@ class SendIncidentEmailNotificationHandler 'text_content' => $incident->message, 'token' => $subscriber->token, 'unsubscribe_link' => route('subscribe.unsubscribe', ['code' => $subscriber->verify_code]), - 'app_url' => env('APP_URL'), ]; $this->mailer->queue([ diff --git a/app/Handlers/Events/Incident/SendMaintenanceEmailNotificationHandler.php b/app/Handlers/Events/Incident/SendMaintenanceEmailNotificationHandler.php index d942979e..70530ce2 100644 --- a/app/Handlers/Events/Incident/SendMaintenanceEmailNotificationHandler.php +++ b/app/Handlers/Events/Incident/SendMaintenanceEmailNotificationHandler.php @@ -72,7 +72,6 @@ class SendMaintenanceEmailNotificationHandler 'scheduled_at' => $data->scheduled_at_formatted, 'token' => $subscriber->token, 'unsubscribe_link' => route('subscribe.unsubscribe', ['code' => $subscriber->verify_code]), - 'app_url' => env('APP_URL'), ]; $this->mailer->queue([ diff --git a/app/Handlers/Events/Subscriber/SendSubscriberVerificationEmailHandler.php b/app/Handlers/Events/Subscriber/SendSubscriberVerificationEmailHandler.php index d0d667fa..9bddb25a 100644 --- a/app/Handlers/Events/Subscriber/SendSubscriberVerificationEmailHandler.php +++ b/app/Handlers/Events/Subscriber/SendSubscriberVerificationEmailHandler.php @@ -49,7 +49,6 @@ class SendSubscriberVerificationEmailHandler 'email' => $event->subscriber->email, 'subject' => 'Confirm your subscription.', 'link' => route('subscribe.verify', ['code' => $event->subscriber->verify_code]), - 'app_url' => env('APP_URL'), ]; $this->mailer->queue([ diff --git a/app/Handlers/Events/User/SendInviteUserEmailHandler.php b/app/Handlers/Events/User/SendInviteUserEmailHandler.php index ccb78df4..f02b9dca 100644 --- a/app/Handlers/Events/User/SendInviteUserEmailHandler.php +++ b/app/Handlers/Events/User/SendInviteUserEmailHandler.php @@ -49,7 +49,6 @@ class SendInviteUserEmailHandler 'email' => $event->invite->email, 'subject' => 'You have been invited.', 'link' => route('signup.invite', ['code' => $event->invite->code]), - 'app_url' => env('APP_URL'), ]; $this->mailer->queue([ diff --git a/app/Providers/ConfigServiceProvider.php b/app/Providers/ConfigServiceProvider.php index 5848759a..49f4606f 100644 --- a/app/Providers/ConfigServiceProvider.php +++ b/app/Providers/ConfigServiceProvider.php @@ -45,7 +45,7 @@ class ConfigServiceProvider extends ServiceProvider $allowedOrigins[] = $domain; } } else { - $allowedOrigins[] = env('APP_URL'); + $allowedOrigins[] = $this->app->config->get('app.url'); } $this->app->config->set('cors.paths.api/v1/*.allowedOrigins', $allowedOrigins);