Skip to content

Commit

Permalink
Updated SQS config doco
Browse files Browse the repository at this point in the history
  • Loading branch information
ok200paul committed Aug 16, 2024
1 parent 7137b68 commit df01d8f
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 6 deletions.
5 changes: 3 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ SANCTUM_STATEFUL_DOMAINS=vine.test

BROADCAST_CONNECTION=log
FILESYSTEM_DISK=local
QUEUE_CONNECTION=database
QUEUE_CONNECTION=sync

CACHE_STORE=database
CACHE_PREFIX=
Expand All @@ -63,7 +63,8 @@ AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
AWS_USE_PATH_STYLE_ENDPOINT=false

SQS_PREFIX=
SQS_QUEUE=


VITE_APP_NAME="${APP_NAME}"
Expand Down
2 changes: 2 additions & 0 deletions .env.testing
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
AWS_USE_PATH_STYLE_ENDPOINT=false
SQS_PREFIX=
SQS_QUEUE=

VITE_APP_NAME="${APP_NAME}"

18 changes: 15 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,15 +152,27 @@ The S3 bucket uses a configuration called `root`, which separates the base bucke

NOTE: No extra config is required for this behaviour on AWS S3. It is not the default for any other filesystem storage providers.

## Queue Configuration
By default, the queue is set to `sync`: `QUEUE_CONNECTION=sync` which runs jobs as part of the current request. You are free to reconfigure this.

If using AWS SQS, you need to create queues for each environment, and update the env vars as follows:

```dotenv
QUEUE_CONNECTION=sqs
SQS_QUEUE="queue-name-${APP_ENV}" # eg ofn-vine-uk-local as set in AWS SQS
SQS_PREFIX=https://sqs.${AWS_DEFAULT_REGION}.amazonaws.com/[YOUR-AWS-ACCOUNT-ID]
```
You'll also need to run at least one properly configured queue worker on your server environment for this to work.

## API Middleware - Protecting The API

In /bootstrap.app.php we've configured middleware as follows:

```php
$middleware->alias([
'abilities' => CheckForAnyTokenAbilities::class,
]);
$middleware->alias(
[
'abilities' => CheckForAnyTokenAbilities::class,
]);
```

This runs the API middleware through `CheckForAnyTokenAbilities`, checking the incoming personal access token for the
Expand Down
9 changes: 8 additions & 1 deletion app/Console/Commands/TestCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

namespace App\Console\Commands;


use App\Jobs\TestJob;
use App\Models\User;
use Illuminate\Console\Command;

class TestCommand extends Command
Expand All @@ -23,5 +26,9 @@ class TestCommand extends Command
/**
* Execute the console command.
*/
public function handle() {}
public function handle() {



}
}

0 comments on commit df01d8f

Please sign in to comment.