mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[s3] add region specific endpoints
This commit is contained in:
parent
cae08a7134
commit
3be8b85c40
2 changed files with 19 additions and 12 deletions
|
@ -176,17 +176,17 @@ module Fog
|
|||
@aws_secret_access_key = options[:aws_secret_access_key]
|
||||
@hmac = HMAC::SHA256.new(@aws_secret_access_key)
|
||||
@host = options[:host] || case options[:region]
|
||||
when 'ap-southeast-1'
|
||||
'ec2.ap-southeast-1.amazonaws.com'
|
||||
when 'eu-west-1'
|
||||
'ec2.eu-west-1.amazonaws.com'
|
||||
when 'us-east-1'
|
||||
'ec2.us-east-1.amazonaws.com'
|
||||
when 'us-west-1'
|
||||
'ec2.us-west-1.amazonaws.com'
|
||||
else
|
||||
'ec2.amazonaws.com'
|
||||
end
|
||||
when 'ap-southeast-1'
|
||||
'ec2.ap-southeast-1.amazonaws.com'
|
||||
when 'eu-west-1'
|
||||
'ec2.eu-west-1.amazonaws.com'
|
||||
when 'us-east-1'
|
||||
'ec2.us-east-1.amazonaws.com'
|
||||
when 'us-west-1'
|
||||
'ec2.us-west-1.amazonaws.com'
|
||||
else
|
||||
'ec2.amazonaws.com'
|
||||
end
|
||||
@port = options[:port] || 443
|
||||
@scheme = options[:scheme] || 'https'
|
||||
end
|
||||
|
|
|
@ -127,7 +127,14 @@ module Fog
|
|||
raise ArgumentError.new('aws_secret_access_key is required to access ec2')
|
||||
end
|
||||
@hmac = HMAC::SHA1.new(@aws_secret_access_key)
|
||||
@host = options[:host] || 's3.amazonaws.com'
|
||||
@host = options[:host] || case options[:region]
|
||||
when 'ap-southeast-1'
|
||||
's3-ap-southeast-1.amazonaws.com'
|
||||
when 'us-west-1'
|
||||
's3-us-west-1.amazonaws.com'
|
||||
else
|
||||
's3.amazonaws.com'
|
||||
end
|
||||
@port = options[:port] || 443
|
||||
@scheme = options[:scheme] || 'https'
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue