Skip to content

Commit 19a58b3

Browse files
committedMar 18, 2021
Use Flysystem AWS client
1 parent 528dd78 commit 19a58b3

File tree

3 files changed

+12
-11
lines changed

3 files changed

+12
-11
lines changed
 

‎README.md

+10-3
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,16 @@ https://uppy.io/docs/aws-s3/#S3-Bucket-configuration
178178

179179
#### Add S3 Transfer Acceleration
180180

181-
To use [S3 transfer acceleration](https://docs.aws.amazon.com/AmazonS3/latest/userguide/transfer-acceleration.html), enable it by adding a
182-
a `AWS_USE_ACCELERATE_ENDPOINT=true` env var on your `.env` file.
181+
To use [S3 transfer acceleration](https://docs.aws.amazon.com/AmazonS3/latest/userguide/transfer-acceleration.html),
182+
enable it by adding a `AWS_USE_ACCELERATE_ENDPOINT=true` env var on your `.env` file,
183+
and add `'use_accelerate_endpoint' => env('AWS_USE_ACCELERATE_ENDPOINT')` in `s3` options on your `config/filesystems.php`:
184+
185+
```php
186+
's3' => [
187+
...
188+
'use_accelerate_endpoint' => env('AWS_USE_ACCELERATE_ENDPOINT'),
189+
],
190+
```
183191

184192
#### Configuration
185193

@@ -200,7 +208,6 @@ return [
200208
*/
201209
'expiry_time' => '+30 minutes',
202210
],
203-
'use_accelerate_endpoint' => env('AWS_USE_ACCELERATE_ENDPOINT'),
204211
],
205212
];
206213
```

‎config/uppy-s3-multipart-upload.php

-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,5 @@
1414
*/
1515
'expiry_time' => '+1 hour',
1616
],
17-
'use_accelerate_endpoint' => env('AWS_USE_ACCELERATE_ENDPOINT'),
1817
],
1918
];

‎src/Http/Controllers/UppyS3MultipartController.php

+2-7
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@
22

33
namespace Tapp\LaravelUppyS3MultipartUpload\Http\Controllers;
44

5-
use Aws\Credentials\Credentials;
6-
use Aws\S3\S3Client;
75
use Illuminate\Http\Request;
86
use Illuminate\Http\Response;
7+
use Illuminate\Support\Facades\Storage;
98
use Illuminate\Support\Str;
109
use Throwable;
1110

@@ -17,11 +16,7 @@ class UppyS3MultipartController extends Controller
1716

1817
public function __construct()
1918
{
20-
$this->client = new S3Client([
21-
'version' => 'latest',
22-
'region' => config('filesystems.disks.s3.region'),
23-
'use_accelerate_endpoint' => config('uppy-s3-multipart-upload.s3.use_accelerate_endpoint'),
24-
]);
19+
$this->client = Storage::disk('s3')->getDriver()->getAdapter()->getClient();
2520

2621
$this->bucket = config('filesystems.disks.s3.bucket');
2722
}

0 commit comments

Comments
 (0)
Please sign in to comment.