我过了一天尝试搜索如何使用AWS在Heroku上配置回形针,但我无法做到。
我的斗地点是东京所以s3-ap-northeast-1.amazonaws.com
这是我的文件夹(emangakaimg是我的桶)
#initializers/paperclip.rb
Paperclip::Attachment.default_options[:url] = 'emangakaimg.s3.amazonaws.com'
Paperclip::Attachment.default_options[:path] = '/:class/:attachment/:id_partition/:style/:filename'
Paperclip::Attachment.default_options[:s3_host_name] = 's3-ap-northeast-1.amazonaws.com'
#config/environments/production.rb
config.paperclip_defaults = {
storage: :s3,
s3_credentials: {
bucket: ENV.fetch('S3_BUCKET_NAME'),
access_key_id: ENV.fetch('AWS_ACCESS_KEY_ID'),
secret_access_key: ENV.fetch('AWS_SECRET_ACCESS_KEY'),
s3_region: ENV.fetch('AWS_REGION'),
}
}
#models/materiel.rb
class Materiel < ActiveRecord::Base
belongs_to :user
belongs_to :materielcategory
has_attached_file :couverture, :styles => { :hd => "1920x1080#" }, :default_url => "/images/:style/missing.png"
validates_attachment_content_type :couverture, :content_type => /\Aimage\/.*\Z/
end
#controllers/materiels_controller.rb
def materiel_params
params.require(:materiel).permit(:couverture, :title, :content, :materielcategory_id)
end
我的错误是什么? heroku config:set是可配置的
非常感谢