From ab4dbcb5f7b54c0549dbf25a94860d299a4a3067 Mon Sep 17 00:00:00 2001 From: geemus Date: Fri, 24 Sep 2010 14:36:42 -0700 Subject: [PATCH] [aws][storage] storage needs to set host so that x_object_url methods will work --- lib/fog/aws/storage.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/fog/aws/storage.rb b/lib/fog/aws/storage.rb index c4c4d6963..fbcf881c8 100644 --- a/lib/fog/aws/storage.rb +++ b/lib/fog/aws/storage.rb @@ -92,6 +92,18 @@ module Fog def initialize(options={}) @aws_access_key_id = options[:aws_access_key_id] @region = options[:region] || 'us-east-1' + @host = options[:host] || case options[:region] + when 'eu-west-1' + 's3-eu-west-1.amazonaws.com' + when 'us-east-1' + 's3.amazonaws.com' + when 'ap-southeast-1' + 's3-ap-southeast-1.amazonaws.com' + when 'us-west-1' + 's3-us-west-1.amazonaws.com' + else + raise ArgumentError, "Unknown region: #{options[:region].inspect}" + end @data = self.class.data[@region][@aws_access_key_id] end