Changeset 165

Show
Ignore:
Timestamp:
01/19/08 13:29:37 (10 months ago)
Author:
mart
Message:

added the aws_prefix option to configure multiple backup targets
on a single Amazon account.

Patch from Alessandro Ranellucci.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/Changes

    r162 r165  
     1  - added the aws_prefix option to configure multiple backup targets 
     2    on a single Amazon account. from Alessandro Ranellucci <aar@cpan.org>. 
     3 
    141.05 (august 2, 2007) 
    25 
  • trunk/lib/Brackup/Target/Amazon.pm

    r161 r165  
    99#   access_key_id 
    1010#   sec_access_key_id 
    11 #   chunk_bucket : $self->{access_key_id} . "-chunks"; 
    12 #   backup_bucket : $self->{access_key_id} . "-backups"; 
     11#   prefix 
     12#   chunk_bucket : $self->{prefix} . "-chunks"; 
     13#   backup_bucket : $self->{prefix} . "-backups"; 
    1314# 
    1415 
     
    2122    $self->{sec_access_key_id} = $confsec->value("aws_secret_access_key") 
    2223        or die "No 'aws_secret_access_key'"; 
     24    $self->{prefix} = $confsec->value("aws_prefix") || $self->{access_key_id}; 
    2325 
    2426    $self->_common_s3_init; 
     
    4244sub _common_s3_init { 
    4345    my $self = shift; 
    44     $self->{chunk_bucket}  = $self->{access_key_id} . "-chunks"; 
    45     $self->{backup_bucket} = $self->{access_key_id} . "-backups"; 
     46    $self->{chunk_bucket}  = $self->{prefix} . "-chunks"; 
     47    $self->{backup_bucket} = $self->{prefix} . "-backups"; 
    4648    $self->{s3}            = Net::Amazon::S3->new({ 
    4749        aws_access_key_id     => $self->{access_key_id}, 
     
    6769    my $sec_accesskey = ($ENV{'AWS_SEC_KEY'} || _prompt("Your Amazon AWS secret access key? ")) 
    6870        or die "Need your Amazon secret access key.\n"; 
     71    my $prefix = ($ENV{'AWS_PREFIX'} || _prompt("Your Amazon AWS prefix? (Leave empty if none) ")); 
    6972 
    7073    my $self = bless {}, $class; 
    7174    $self->{access_key_id}     = $accesskey; 
    7275    $self->{sec_access_key_id} = $sec_accesskey; 
     76    $self->{prefix}            = $prefix || $self->{access_key_id}; 
    7377    $self->_common_s3_init; 
    7478    return $self; 
     
    208212  aws_access_key_id  = ... 
    209213  aws_secret_access_key =  .... 
     214  aws_prefix =  .... 
    210215 
    211216=head1 CONFIG OPTIONS 
    212217 
     218All options may be omitted unless specified. 
     219 
    213220=over 
    214221 
    215222=item B<type> 
    216223 
    217 Must be "B<Amazon>". 
     224I<(Mandatory.)> Must be "B<Amazon>". 
    218225 
    219226=item B<aws_access_key_id> 
    220227 
    221 Your Amazon Web Services access key id. 
     228I<(Mandatory.)> Your Amazon Web Services access key id. 
    222229 
    223230=item B<aws_secret_access_key> 
    224231 
    225 Your Amazon Web Services secret password for the above access key.  (not your Amazon password) 
     232I<(Mandatory.)> Your Amazon Web Services secret password for the above access key.  (not your Amazon password) 
     233 
     234=item B<aws_prefix> 
     235 
     236If you want to setup multiple backup targets on a single Amazon account you can 
     237use different prefixes. This string is used to name the S3 buckets created by 
     238Brackup. If not specified it defaults to the AWS access key id. 
    226239 
    227240=back