Update rackspace files to work with Swift

This commit is contained in:
Caleb Tennis 2010-08-19 15:28:10 -04:00 committed by geemus
parent 0803a9cf3f
commit fb5f9ff944
2 changed files with 11 additions and 8 deletions

View File

@ -5,7 +5,8 @@ module Fog
module Rackspace
def self.authenticate(options)
connection = Fog::Connection.new("https://auth.api.rackspacecloud.com")
rackspace_auth_url = options[:rackspace_auth_url] || "auth.api.rackspacecloud.com"
connection = Fog::Connection.new("https://" + rackspace_auth_url)
@rackspace_api_key = options[:rackspace_api_key]
@rackspace_username = options[:rackspace_username]
response = connection.request({
@ -14,7 +15,7 @@ module Fog
'X-Auth-Key' => @rackspace_api_key,
'X-Auth-User' => @rackspace_username
},
:host => 'auth.api.rackspacecloud.com',
:host => rackspace_auth_url,
:method => 'GET',
:path => 'v1.0'
})

View File

@ -79,12 +79,14 @@ module Fog
credentials = Fog::Rackspace.authenticate(options)
@auth_token = credentials['X-Auth-Token']
cdn_uri = URI.parse(credentials['X-CDN-Management-Url'])
@cdn_host = cdn_uri.host
@cdn_path = cdn_uri.path
@cdn_port = cdn_uri.port
@cdn_scheme = cdn_uri.scheme
@cdn_connection = Fog::Connection.new("#{@cdn_scheme}://#{@cdn_host}:#{@cdn_port}", options[:persistent])
if(credentials['X-CDN-Management-Url'])
cdn_uri = URI.parse(credentials['X-CDN-Management-Url'])
@cdn_host = cdn_uri.host
@cdn_path = cdn_uri.path
@cdn_port = cdn_uri.port
@cdn_scheme = cdn_uri.scheme
@cdn_connection = Fog::Connection.new("#{@cdn_scheme}://#{@cdn_host}:#{@cdn_port}", options[:persistent])
end
storage_uri = URI.parse(credentials['X-Storage-Url'])
@storage_host = storage_uri.host