feat(v5): gate V5 to development environments only

Introduce V5Feature and config so V5 routes, jobs, commands, morph maps,
and model queries run only when enabled. Move V5 migrations to
migrations-v5 (loaded only when enabled), remove Flux from production
Docker/install paths, and add isolation tests.
This commit is contained in:
Andras Bacsai committed 2026-07-19 11:44:12 +02:00
1 parent 1cb1d028de
commit d0247d3b09
45 files changed
+273 -218

No files matched your search

+12 -11
View File
@@ -2,6 +2,7 @@
namespace App\Providers;
use App\Support\V5\V5Feature;
use Illuminate\Cache\RateLimiting\Limit;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
use Illuminate\Http\Request;
@@ -34,10 +35,12 @@ class RouteServiceProvider extends ServiceProvider
Route::prefix('webhooks')
->group(base_path('routes/webhooks.php'));
Route::middleware('v5.web')
->prefix('v5')
->as('v5.')
->group(base_path('routes/v5.php'));
if (V5Feature::enabled()) {
Route::middleware('v5.web')
->prefix('v5')
->as('v5.')
->group(base_path('routes/v5.php'));
}
Route::middleware('web')
->group(base_path('routes/web.php'));
@@ -60,13 +63,11 @@ class RouteServiceProvider extends ServiceProvider
return Limit::perMinute(5)->by($request->user()?->id ?: $request->ip());
});
// v5 authenticated web endpoints run synchronous SSH/Flux work per
// request (connectivity checks, bootstrap, diagnostics). Throttle per
// user so a single member cannot pin FPM workers by hammering them,
// while leaving ample headroom for the canvas's 3s cluster polling.
RateLimiter::for('v5', function (Request $request) {
return Limit::perMinute(120)->by($request->user()?->id ?: $request->ip());
});
if (V5Feature::enabled()) {
RateLimiter::for('v5', function (Request $request) {
return Limit::perMinute(120)->by($request->user()?->id ?: $request->ip());
});
}
RateLimiter::for('feedback', function (Request $request) {
return Limit::perMinute(3)->by($request->user()?->id ?: $request->ip());