Make webhook host configurable via WEBHOOK_URL (sendkit-style domain group)

This commit is contained in:
Paulo Castellano 2026-06-14 09:31:00 -03:00
parent cc61adbac2
commit e72bf51c38
4 changed files with 27 additions and 2 deletions

View file

@ -4,6 +4,10 @@ APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost
# Public base URL inbound webhooks (e.g. Telegram) are registered on.
# Defaults to APP_URL; set a tunnel URL (e.g. ngrok) for local development.
WEBHOOK_URL=
# Self-hosted mode (skips payment requirements)
SELF_HOSTED=true

View file

@ -54,7 +54,20 @@
|
*/
'url' => env('APP_URL', 'https://trypost.it'),
'url' => env('APP_URL', 'https://app.trypost.it'),
/*
|--------------------------------------------------------------------------
| Webhook URL
|--------------------------------------------------------------------------
|
| Public base URL that inbound provider webhooks (e.g. Telegram) are
| registered on. Defaults to the app URL; override it (for example with a
| tunnel like ngrok) when the app URL isn't reachable from the internet.
|
*/
'webhook_url' => env('WEBHOOK_URL', env('APP_URL', 'https://app.trypost.it')),
/*
|--------------------------------------------------------------------------

View file

@ -4,6 +4,10 @@ APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost:8000
# Public base URL inbound webhooks (e.g. Telegram) are registered on.
# Defaults to APP_URL; set a tunnel URL (e.g. ngrok) for local development.
WEBHOOK_URL=
# Self-hosted mode (skips payment requirements)
SELF_HOSTED=true

View file

@ -5,4 +5,8 @@
use App\Http\Controllers\Webhooks\TelegramWebhookController;
use Illuminate\Support\Facades\Route;
Route::post('telegram/webhook', [TelegramWebhookController::class, 'handle'])->name('telegram.webhook');
Route::group([
'domain' => parse_url(config('app.webhook_url'), PHP_URL_HOST) ?: config('app.webhook_url'),
], function () {
Route::post('telegram/webhook', [TelegramWebhookController::class, 'handle'])->name('telegram.webhook');
});