qoobaa / s3

Library for accessing S3 objects and buckets, supports EU and US buckets
MIT License
258 stars 112 forks source link

Support custom S3 Host #92

Closed gabamnml closed 9 years ago

gabamnml commented 10 years ago

Today I have to do this, having to re initialize the constant HOST

S3_SERVICE = S3::Service.new(
  access_key_id: AMAZON_ACCESS_KEY_ID,
  secret_access_key: AMAZON_SECRET_ACCESS_KEY
)
S3::HOST = 's3-us-west-2.amazonaws.com'

And I wish I could do this :

S3_SERVICE = S3::Service.new(
  access_key_id: AMAZON_ACCESS_KEY_ID,
  secret_access_key: AMAZON_SECRET_ACCESS_KEY
  host: 's3-us-west-2.amazonaws.com'
)

To avoid warnings about reinitialization of constant.

qoobaa commented 10 years ago

It shouldn't be difficult to implement. Could you try to create a pull request with that change? I'm extremely busy recently.

gabamnml commented 10 years ago

change the way that I am working with the gem. I do not need this feature. thanks anyway

danielerapati commented 9 years ago

Hi gabamnmi, by any chance do you remember how you worked around this issue? Thanks, Daniele

gabamnml commented 9 years ago

@danielerapati Sure. Just remove custom HOST and use by default because S3 does not handle zone changes.

arthurnn commented 9 years ago

You can use the proxy option to accomplish this. https://github.com/qoobaa/s3/blob/master/lib/s3/service.rb#L33

S3::Service.new(access_key_id: 'k', secret_access_key: 's',  proxy: {host: uri.host, port: uri.port})