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

Commit

Permalink
Merge pull request #7 from paulofreitas/master
Browse files Browse the repository at this point in the history
Added support for configuring AWS S3 region
  • Loading branch information
dmyers committed Jul 11, 2014
2 parents ea08dec + d9f7843 commit 6038db5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
9 changes: 8 additions & 1 deletion src/Dmyers/Storage/Adapter/AmazonS3.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ public function __construct()
throw new \RuntimeException('AmazonS3 secret config required.');
}

$region = $this->config('region');

if (empty($region)) {
throw new \RuntimeException('AmazonS3 region config required.');
}

$bucket = $this->config('bucket');

if (empty($bucket)) {
Expand All @@ -33,6 +39,7 @@ public function __construct()
$this->client = S3Client::factory(array(
'key' => $key,
'secret' => $secret,
'region' => $region,
));
}

Expand Down Expand Up @@ -247,4 +254,4 @@ protected function computePath($path)

return S3Client::encodeKey($path);
}
}
}
3 changes: 2 additions & 1 deletion src/config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
'amazons3' => array(
'key' => '',
'secret' => '',
'region' => 'us-east-1',
'bucket' => '',
'acl' => 'public-read',
),
Expand Down Expand Up @@ -53,4 +54,4 @@
*/
'route_path' => false,

);
);

0 comments on commit 6038db5

Please sign in to comment.