From 0e038ff350bf0047af5e3b138234c5ad920d9ad3 Mon Sep 17 00:00:00 2001 From: Snider Date: Thu, 12 Mar 2026 14:25:17 +0000 Subject: [PATCH] =?UTF-8?q?feat(webhook):=20add=20config=20+=20Boot=20?= =?UTF-8?q?=E2=80=94=20route=20registration,=20cron=20trigger=20config?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.6 --- src/Core/Webhook/Boot.php | 36 ++++++++++++++++++++ src/Core/Webhook/config.php | 65 +++++++++++++++++++++++++++++++++++++ 2 files changed, 101 insertions(+) create mode 100644 src/Core/Webhook/Boot.php create mode 100644 src/Core/Webhook/config.php diff --git a/src/Core/Webhook/Boot.php b/src/Core/Webhook/Boot.php new file mode 100644 index 0000000..43467c0 --- /dev/null +++ b/src/Core/Webhook/Boot.php @@ -0,0 +1,36 @@ + 'onApiRoutes', + ]; + + public function register(): void + { + $this->mergeConfigFrom(__DIR__.'/config.php', 'webhook'); + } + + public function onApiRoutes(ApiRoutesRegistering $event): void + { + $event->routes(fn () => Route::post( + '/webhooks/{source}', + [WebhookController::class, 'handle'] + )->where('source', '[a-z0-9\-]+')); + } +} diff --git a/src/Core/Webhook/config.php b/src/Core/Webhook/config.php new file mode 100644 index 0000000..9538169 --- /dev/null +++ b/src/Core/Webhook/config.php @@ -0,0 +1,65 @@ + [ + 'altum-biolinks' => env('ALTUM_BIOLINKS_WEBHOOK_SECRET'), + 'altum-analytics' => env('ALTUM_ANALYTICS_WEBHOOK_SECRET'), + 'altum-pusher' => env('ALTUM_PUSHER_WEBHOOK_SECRET'), + 'altum-socialproof' => env('ALTUM_SOCIALPROOF_WEBHOOK_SECRET'), + ], + + /* + |-------------------------------------------------------------------------- + | Cron Triggers + |-------------------------------------------------------------------------- + | + | Outbound HTTP triggers that replace Docker cron containers. + | The CronTrigger action hits these endpoints every minute. + | + */ + 'cron_triggers' => [ + 'altum-biolinks' => [ + 'base_url' => env('ALTUM_BIOLINKS_URL'), + 'key' => env('ALTUM_BIOLINKS_CRON_KEY'), + 'endpoints' => ['/cron', '/cron/email_reports', '/cron/broadcasts', '/cron/push_notifications'], + 'stagger_seconds' => 15, + 'offset_seconds' => 5, + ], + 'altum-analytics' => [ + 'base_url' => env('ALTUM_ANALYTICS_URL'), + 'key' => env('ALTUM_ANALYTICS_CRON_KEY'), + 'endpoints' => ['/cron', '/cron/email_reports', '/cron/broadcasts', '/cron/push_notifications'], + 'stagger_seconds' => 15, + 'offset_seconds' => 0, + ], + 'altum-pusher' => [ + 'base_url' => env('ALTUM_PUSHER_URL'), + 'key' => env('ALTUM_PUSHER_CRON_KEY'), + 'endpoints' => [ + '/cron/reset', '/cron/broadcasts', '/cron/campaigns', + '/cron/flows', '/cron/flows_notifications', '/cron/personal_notifications', + '/cron/rss_automations', '/cron/recurring_campaigns', '/cron/push_notifications', + ], + 'stagger_seconds' => 7, + 'offset_seconds' => 7, + ], + 'altum-socialproof' => [ + 'base_url' => env('ALTUM_SOCIALPROOF_URL'), + 'key' => env('ALTUM_SOCIALPROOF_CRON_KEY'), + 'endpoints' => ['/cron', '/cron/email_reports', '/cron/broadcasts', '/cron/push_notifications'], + 'stagger_seconds' => 15, + 'offset_seconds' => 10, + ], + ], +];