]> git.imager.perl.org - bse.git/commitdiff
add a host config parameter for S3 storages
authorTony Cook <tony@develop-help.com>
Fri, 22 Jul 2016 05:02:46 +0000 (15:02 +1000)
committerTony Cook <tony@develop-help.com>
Fri, 22 Jul 2016 05:02:46 +0000 (15:02 +1000)
site/cgi-bin/modules/BSE/Storage/AmazonS3.pm

index 656b8bfa53cec23168fc06904b82a3ab6e451d2d..922f0977f1bc9bc37d7e5e8713071cdc2f268edd 100644 (file)
@@ -5,7 +5,7 @@ our @ISA = qw(BSE::Storage::Base);
 use Net::Amazon::S3;
 use Carp qw(confess);
 
-our $VERSION = "1.000";
+our $VERSION = "1.001";
 
 sub new {
   my ($class, %opts) = @_;
@@ -19,6 +19,7 @@ sub new {
       or confess "Missing $key from configuration";
   }
   $self->{prefix} = $self->configure('prefix', '');
+  $self->{host} = $self->configure('host', 's3.amazonaws.com');
 
   return $self;
 }
@@ -30,7 +31,8 @@ sub _connect {
     (
      {
       aws_access_key_id => $self->{keyid},
-      aws_secret_access_key => $self->{accesskey}
+      aws_secret_access_key => $self->{accesskey},
+      host => $self->{host},
      }
     );
 
@@ -142,9 +144,17 @@ BSE::Storage::AmazonS3 - storage that stores via Amazon S3.
   accesskey=...
   bucket=ftppassword
   cond=...
+  host=...
 
 =head1 DESCRIPTION
 
 This is a BSE storage that accesses the remote store via Amazon S3.
 
+C<host> must be set to the end-point matching the location of the
+bucket, see:
+
+  http://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region
+
+for details.  Defaults to C<s3.amazonaws.com> if not set.
+
 =cut