Skip to content
This repository was archived by the owner on Nov 10, 2022. It is now read-only.

Commit d9f7843

Browse files
committed
Added support for configuring AWS S3 region.
This fixes raising Aws\S3�xception\BucketAlreadyOwnedByYouException when your bucket is located in a non default region.
1 parent ea08dec commit d9f7843

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/Dmyers/Storage/Adapter/AmazonS3.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ public function __construct()
2222
throw new \RuntimeException('AmazonS3 secret config required.');
2323
}
2424

25+
$region = $this->config('region');
26+
27+
if (empty($region)) {
28+
throw new \RuntimeException('AmazonS3 region config required.');
29+
}
30+
2531
$bucket = $this->config('bucket');
2632

2733
if (empty($bucket)) {
@@ -33,6 +39,7 @@ public function __construct()
3339
$this->client = S3Client::factory(array(
3440
'key' => $key,
3541
'secret' => $secret,
42+
'region' => $region,
3643
));
3744
}
3845

@@ -247,4 +254,4 @@ protected function computePath($path)
247254

248255
return S3Client::encodeKey($path);
249256
}
250-
}
257+
}

src/config/config.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
'amazons3' => array(
2626
'key' => '',
2727
'secret' => '',
28+
'region' => 'us-east-1',
2829
'bucket' => '',
2930
'acl' => 'public-read',
3031
),
@@ -53,4 +54,4 @@
5354
*/
5455
'route_path' => false,
5556

56-
);
57+
);

0 commit comments

Comments
 (0)