AssetSync/asset_sync

Option to disable fog’s signature v4 streaming

Closed this issue · 1 comments

sunny commented

In Fog we can disable AWS’s enable_signature_v4_streaming: false. This helps when using S3-compatible hosting providers that don’t implement streaming. Without this option an error is raised saying "STREAMING-AWS4-HMAC-SHA256-PAYLOAD" is not implemented.

One workaround is doing the following:

module DisableFogSignatureV4Streaming
  def fog_options
    super.merge(enable_signature_v4_streaming: false)
  end
end

AssetSync.configure do |config|
  config.extend(DisableFogSignatureV4Streaming)
  
  # …
end

To make this more robust, we could add a new option to asset_sync. Either:

  • A new fog_enable_signature_v4_streaming option.
  • A more general fog_options to add any extra option fog supports.

What do you think? I’d be happy to provide a pull-request if any of these solutions seem good.

I guess the current style would be introducing another option

if aws?
if aws_iam?
options.merge!({
:use_iam_profile => true
})
else
options.merge!({
:aws_access_key_id => aws_access_key_id,
:aws_secret_access_key => aws_secret_access_key
})
options.merge!({:aws_session_token => aws_session_token}) if aws_session_token
end
options.merge!({:host => fog_host}) if fog_host
options.merge!({:port => fog_port}) if fog_port
options.merge!({:scheme => fog_scheme}) if fog_scheme
options.merge!({:aws_signature_version => aws_signature_version}) if aws_signature_version
options.merge!({:path_style => fog_path_style}) if fog_path_style
options.merge!({:region => fog_region}) if fog_region

But if you want to implement a way to add more flexible fog options that's welcome too
I have no preference :)