I've set heroku config vars with AWS credentials using:
heroku config:set S3_ACCESS_KEY=<....>
heroku config:set S3_SECRET_KEY=<....>
heroku config:set S3_BUCKET=<....>
and verified them on heroku:
heroku run rails console
CarrierWave.configure do |config|
puts config.fog_directory
puts config.fog_credentials
end
On my config/initializers/carrier_wave.rb file, I've got:
if Rails.env.production?
CarrierWave.configure do |config|
config.fog_credentials = {
:provider => 'AWS',
:aws_access_key_id => ENV['S3_ACCESS_KEY'],
:aws_secret_access_key => ENV['S3_SECRET_KEY']
}
config.fog_directory = ENV['S3_BUCKET']
end
end
On app/uploaders/picture_uploader.rb file I've got:
if Rails.env.production?
storage :fog
else
storage :file
end
When deploying the app on heroku everything seems to be ok but trying upload a file leads to an Application Error page... Does this have to do with AWS rather than my code?
Aucun commentaire:
Enregistrer un commentaire