1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

Add a new cdn uri to the Storage service to enable a CDN service from within the Storage service.

This commit is contained in:
Rupak Ganguly 2011-11-11 16:12:57 -05:00
parent 82346ab8f0
commit d125fdc3eb

View file

@ -6,7 +6,7 @@ module Fog
class HP < Fog::Service class HP < Fog::Service
requires :hp_secret_key, :hp_account_id requires :hp_secret_key, :hp_account_id
recognizes :hp_auth_uri, :hp_servicenet, :hp_cdn_ssl, :persistent, :connection_options recognizes :hp_auth_uri, :hp_servicenet, :hp_cdn_ssl, :hp_cdn_uri, :persistent, :connection_options
model_path 'fog/hp/models/storage' model_path 'fog/hp/models/storage'
model :directory model :directory
@ -29,17 +29,21 @@ module Fog
module Utils module Utils
def cdn def cdn
#@cdn ||= Fog::CDN.new( unless @hp_cdn_uri.nil?
# :provider => 'HP', @cdn ||= Fog::CDN.new(
# :hp_account_id => @hp_account_id, :provider => 'HP',
# :hp_secret_key => @hp_secret_key, :hp_account_id => @hp_account_id,
# :hp_auth_uri => @hp_auth_uri :hp_secret_key => @hp_secret_key,
#) :hp_auth_uri => @hp_auth_uri,
#if @cdn.enabled? :hp_cdn_uri => @hp_cdn_uri
# @cdn )
#end if @cdn.enabled?
@cdn
end
else
nil nil
end end
end
def url def url
"#{@scheme}://#{@host}:#{@port}#{@path}" "#{@scheme}://#{@host}:#{@port}#{@path}"
@ -138,6 +142,7 @@ module Fog
@hp_account_id = options[:hp_account_id] @hp_account_id = options[:hp_account_id]
@hp_auth_uri = options[:hp_auth_uri] @hp_auth_uri = options[:hp_auth_uri]
@hp_cdn_ssl = options[:hp_cdn_ssl] @hp_cdn_ssl = options[:hp_cdn_ssl]
@hp_cdn_uri = options[:hp_cdn_uri]
@connection_options = options[:connection_options] || {} @connection_options = options[:connection_options] || {}
credentials = Fog::HP.authenticate(options, @connection_options) credentials = Fog::HP.authenticate(options, @connection_options)
@auth_token = credentials['X-Auth-Token'] @auth_token = credentials['X-Auth-Token']