Just an update. I found that while the s3_endpoint was being deprecated, the 
reason that it stopped working in my case wasn't due to removal, rather an 
alteration in how the configuration object is built.

The following didn't work:

AWS.config(:use_ssl => false,
          :access_key_id => "X", 
          :secret_access_key => "Y",
          :s3_endpoint => "mystorage.com")

but the following did

AWS::S3
AWS.config(:use_ssl => false,
          :access_key_id => "X", 
          :secret_access_key => "Y",
          :s3_endpoint => "mystorage.com")

This is because the attributes on the AWS.config object are dynamically built 
as more modules are accessed. Setting S3 endpoint before loading the S3 module 
must cause it to be over-written (likely due to the added reliance on region 
naming to infer endpoint address) when the s3.rb file is loaded into Ruby.

Anyway, a quick monkey patch to resolve the entire problem of AWS switching to 
regions is:

module AWS
  module Core
    class Client
        def endpoint
                if service_ruby_name == "s3" && 
config.send(:"#{service_ruby_name}_region") == "local-s3"
                        "mystorage.com"
                else
                        @endpoint
                end
        end
    end
  end
end

With that monkey patch in, I can just do this:
AWS::S3 #just ensures that the S3 module is loaded - might not have to do in 
future versions
AWS.config(:use_ssl => false,
          :access_key_id => "X", 
          :secret_access_key => "Y",
          :s3_region => "mystorage.com")

That patch ensures that only s3 requests to your local region are affected by 
the change. I would expect any other AWS requests to the actual AWS to be okay. 
Hopefully this helps someone else out as well.
_______________________________________________
riak-users mailing list
[email protected]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com

Reply via email to