Skip to content

Commit

Permalink
Added support for EU buckets with the S3Syncer.
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael van Rooijen committed Jun 3, 2011
1 parent 43721bf commit 37cecb9
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/backup/syncer/s3.rb
Expand Up @@ -48,14 +48,14 @@ def initialize(&block)
# and once it's finished syncing the files and directories to Amazon S3, it'll
# unset these credentials (back to nil values)
def perform!
set_s3sync_credentials!
set_environment_variables!

directories.each do |directory|
Logger.message("#{ self.class } started syncing '#{ directory }'.")
Logger.silent( run("#{ utility(:s3sync) } #{ options } '#{ directory }' '#{ bucket }:#{ path }'") )
end

unset_s3sync_credentials!
unset_environment_variables!
end

##
Expand Down Expand Up @@ -99,16 +99,18 @@ def add(path)
# In order for S3Sync to know what credentials to use, we have to set the
# AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables, these
# evironment variables will be used by S3Sync
def set_s3sync_credentials!
def set_environment_variables!
ENV['AWS_ACCESS_KEY_ID'] = access_key_id
ENV['AWS_SECRET_ACCESS_KEY'] = secret_access_key
ENV['AWS_CALLING_FORMAT'] = 'SUBDOMAIN'
end

##
# Sets the AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY back to nil
def unset_s3sync_credentials!
def unset_environment_variables!
ENV['AWS_ACCESS_KEY_ID'] = nil
ENV['AWS_SECRET_ACCESS_KEY'] = nil
ENV['AWS_CALLING_FORMAT'] = nil
end

end
Expand Down

0 comments on commit 37cecb9

Please sign in to comment.