mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[storage|aws] simplify region accessor
This commit is contained in:
parent
49b7c122ab
commit
3a6c9f1979
1 changed files with 3 additions and 10 deletions
|
@ -55,6 +55,8 @@ module Fog
|
|||
|
||||
module Utils
|
||||
|
||||
attr_accessor :region
|
||||
|
||||
def cdn
|
||||
@cdn ||= Fog::AWS::CDN.new(
|
||||
:aws_access_key_id => @aws_access_key_id,
|
||||
|
@ -92,16 +94,7 @@ module Fog
|
|||
query << "Expires=#{params[:headers]['Date']}"
|
||||
"#{@host}/#{params[:path]}?#{query.join('&')}"
|
||||
end
|
||||
|
||||
def host
|
||||
@host
|
||||
end
|
||||
|
||||
def region
|
||||
region = @region || host.split('.').first.gsub(/s3-?/, '')
|
||||
region.empty? ? 'us-east-1' : region
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
class Mock
|
||||
|
|
Loading…
Reference in a new issue