fox/bootstrap/app.php

43 lines
1.4 KiB
PHP

<?php
use App\Jobs\FoxProactiveJob;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Application;
use Illuminate\Foundation\Configuration\Exceptions;
use Illuminate\Foundation\Configuration\Middleware;
return Application::configure(basePath: dirname(__DIR__))
->withRouting(
web: __DIR__.'/../routes/web.php',
commands: __DIR__.'/../routes/console.php',
channels: __DIR__.'/../routes/channels.php',
health: '/up',
)
->withMiddleware(function (Middleware $middleware) {
// Hinter NPM (Reverse Proxy) - X-Forwarded-* Headers vertrauen,
// damit Laravel HTTPS erkennt und korrekte URLs generiert.
$middleware->trustProxies(at: '*');
$middleware->validateCsrfTokens(except: [
'fox/voice',
'fox/tts',
'fox/poi-context',
'fox/route',
'fox/places',
'fox/geocode',
'fox/place-info',
'fox/cities',
]);
})
->withSchedule(function (Schedule $schedule) {
$minutes = (int) env('FOX_PROACTIVE_INTERVAL_MINUTES', 0);
if ($minutes > 0) {
$schedule->job(new FoxProactiveJob)
->cron(sprintf('*/%d * * * *', $minutes))
->withoutOverlapping()
->name('fox-proactive');
}
})
->withExceptions(function (Exceptions $exceptions) {
//
})->create();