我目前正在努力通过Carrierwave,Carrierwave-aws& amp;费加罗。
但我一直在
OffersController中的SocketError #create
getaddrinfo:名称或服务未知
我已尝试将资产主机更改为' 127.0.0.1'仍然会出现此错误。
carrierwave.rb
CarrierWave.configure do |config|
config.storage = :aws
config.aws_bucket = ENV.fetch('S3_BUCKET_NAME')
config.aws_acl = 'public-read'
# Optionally define an asset host for configurations that are fronted by a
# content host, such as CloudFront.
config.asset_host = 'localhost'
# The maximum period for authenticated_urls is only 7 days.
config.aws_authenticated_url_expiration = 60 * 60 * 24 * 7
# Set custom options such as cache control to leverage browser caching
config.aws_attributes = {
expires: 1.week.from_now.httpdate,
cache_control: 'max-age=604800'
}
config.aws_credentials = {
access_key_id: ENV.fetch('AWS_ACCESS_KEY_ID'),
secret_access_key: ENV.fetch('AWS_SECRET_ACCESS_KEY'),
region: ENV.fetch('AWS_REGION') # Required
}
end
的Gemfile
# Figaro
gem "figaro"
# Carrierwave Integration
gem 'carrierwave'
# Carrierwave AWS
gem 'carrierwave-aws'
对此有任何帮助都很棒。
答案 0 :(得分:0)
尝试从config.asset_host = 'localhost'
删除CarrierWave.configure
。它是可选的,主要用于设置第三方资产路径,如cloudfront。
删除config.asset_host = 'localhost'
然后就完成了。