Git Product home page Git Product logo

Comments (9)

sorentwo avatar sorentwo commented on June 11, 2024

CarrierWave does a dynamic lookup of the storage engine inside of the configuration block. If you say you want the storage to be :fog then it will try and use CarrierWave::Storage::Fog. If you want to use aws instead you need to configure it with storage = :aws. Here is the relevant part from the README:

CarrierWave.configure do |config|
  config.storage    = :aws
  config.aws_bucket = ENV.fetch('S3_BUCKET_NAME')
  config.aws_acl    = :public_read
  config.asset_host = 'http://example.com'
  config.aws_authenticated_url_expiration = 60 * 60 * 24 * 365

  config.aws_credentials = {
    access_key_id:     ENV.fetch('AWS_ACCESS_KEY_ID'),
    secret_access_key: ENV.fetch('AWS_SECRET_ACCESS_KEY')
  }
end

from carrierwave-aws.

dvodvo avatar dvodvo commented on June 11, 2024

CarrierWave does a dynamic lookup of the storage engine inside of
the configuration block. If you say you want the storage to be :fog
then it will try and use CarrierWave::Storage::Fog. If you want to
use aws instead you need to configure it with storage = :aws. Here
is the relevant part from the README:

CarrierWave.configure do |config|
config.storage = :aws
config.aws_bucket = ENV.fetch('S3_BUCKET_NAME')
config.aws_acl = :public_read
config.asset_host = 'http://example.com'
config.aws_authenticated_url_expiration = 60 * 60 * 24 * 365

config.aws_credentials = {
access_key_id: ENV.fetch('AWS_ACCESS_KEY_ID'),
secret_access_key: ENV.fetch('AWS_SECRET_ACCESS_KEY')
}
end

Yeah, I got that, but each uploader could have a storage method, with
an application having mixed methods. The carrierwave documentation
set it an uploader class, i.e.
class ImageUploader < CarrierWave::Uploader::Base
storage :file
and you can have N uploaders. With the initializer it's one-for-all.
By deduction, I'm inclined to guess that the uploader could state
storage :aws
and remove the config.storage line from the initializer? Or
am I waaay off base?

from carrierwave-aws.

sorentwo avatar sorentwo commented on June 11, 2024

No, you aren't off base. The storage deduction is being performed inside of CarrierWave's uploader in that case, but it uses the same exact lookup mechanism.

from carrierwave-aws.

sorentwo avatar sorentwo commented on June 11, 2024

Is there something else I can help with here?

from carrierwave-aws.

dvodvo avatar dvodvo commented on June 11, 2024

Is there something else I can help with here?

Thanks... & sorry if I let you hanging there!

My time zone's quite a bit ahead & lucidity has taken a dive. Will
give it a whirl tomorrow!

J

from carrierwave-aws.

dvodvo avatar dvodvo commented on June 11, 2024

Just to keep you informed, it is functioning in development mode. In production mode I keep hitting a SocketError getaddrinfo: nodename nor servname provided or not know. But that is not due to the SDK. I had earlier tried with fog with the same results. Sticking with this gem though when I understand what is causing the error... unless you can pick it out!
CarrierWave.configure do |config|
config.storage = :aws
config.aws_bucket = 'v4prove'
config.aws_acl = :public_read
config.asset_host = 'https://s3-eu-west-1.amazonaws.com/v4prove'
config.aws_authenticated_url_expiration = 60 * 60 * 24 * 365

config.aws_credentials = {
access_key_id: 'xxx',
secret_access_key: 'xxx'
}
end

from carrierwave-aws.

sorentwo avatar sorentwo commented on June 11, 2024

My guess is that the error is related to your asset_host, but I can't say for sure. I'm glad everything else is working for you though.

from carrierwave-aws.

dvodvo avatar dvodvo commented on June 11, 2024

HI Sorentwo, Got sidetracked for a few weeks on other matters.

I've resolved the above issues, but possibly in unexpected manners.
Minor points: mix 'n match methods means tracking everything down (I had on uploader amongst 7 showing as fog with the gem disabled. duh). I also had the syntax of calling https:// confused with carrierwave's host and endpoint syntassi.

Major point. config.aws_bucket = ENV.fetch('S3_BUCKET_NAME') was leading to the application complaining at start-up. /config/initializers/s3uploads.rb 22 in "fetch" gave me a clue and I had to amend all lines that used fetch as follows: config.aws_bucket = 'S3_BUCKET_NAME'

from carrierwave-aws.

sorentwo avatar sorentwo commented on June 11, 2024

Thanks for reporting back @dvodvo. This may help somebody else in the future.

from carrierwave-aws.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.