Skip to content

Commit

Permalink
Merge pull request #12 from Supernova3339/codespace-supernova3339-shi…
Browse files Browse the repository at this point in the history
…ny-space-goggles-r6j97jx7v9p2wj99

✨ Allow customization of the webhook URL
  • Loading branch information
tnylea authored Apr 19, 2023
2 parents 8d3f0f6 + ddf321f commit 9a08efe
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,8 @@ In the project settings modal there is a tab on the left called **Webhook**, on
Your webhook URL is going to be `your-website.com/tails/webhook`, this route `/tails/webhook`, has already been added in this package. All you have to do is enter the URL inside of the textarea.
> Note: If you need to change the tails webhook URL set the TAILS_WEBHOOK_URL env. This will change /tails/webhook to whatever you want.
### Adding the Webhook Key to your `.env`
In the Webhook modal you will also see another input labeled `Webhook Key`, you will need to copy this value and paste it into your `.env` file like so:
Expand All @@ -208,7 +210,7 @@ In the Webhook modal you will also see another input labeled `Webhook Key`, you
TAILS_WEBHOOK_KEY=DWpXWMHxAdePDleePCYyGgEs2VGe6j
```
This is a security measure, it will gaurantee that the Tails application is the only application sending requests to that endpoint. After you've added this key to your environment file and updated the correct URL in the Webhook modal, you should be all set.
This is a security measure, it will gaurentee that the Tails application is the only application sending requests to that endpoint. After you've added this key to your environment file and updated the correct URL in the Webhook modal, you should be all set.
Each time you are working in the Tails application and a page is saved, it will send a webhook to your application telling it which pages need to be cleared from the cache, this way the new version will be served up the next time someone visits that page.
Expand Down
1 change: 1 addition & 0 deletions config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
'api_key' => env('TAILS_API_KEY', null),
'api_endpoint' => 'https://devdojo.com/api/v1',
'webhook_key' => env('TAILS_WEBHOOK_KEY', null),
'webhook_url' => env('TAILS_WEBHOOK_URL', 'tails/webhook'),

// You can convert HTML tags to any desired blade tags. This conversion will happen
// when the content is pulled from Tails, it will then be rendered as blade tags.
Expand Down
4 changes: 3 additions & 1 deletion src/routes.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php

$webhook_url = config('tails.webhook_url');

// The tails webhook route
Route::post('tails/webhook', '\Devdojo\Tails\Tails@webhook');
Route::post($webhook_url, '\Devdojo\Tails\Tails@webhook');

0 comments on commit 9a08efe

Please sign in to comment.