3

I have the following set up for FOG basically right out of the FOG website:

  def fog_save_file_for(filename, file) 
# create a connection
connection = Fog::Storage.new({
  :provider                 => 'AWS',
  :aws_access_key_id        => '##',
  :aws_secret_access_key    => '##'
})

directory = connection.directories.get('upload_dir')

# list directories
#p connection.directories

# upload that resume
file = directory.files.create(
  :key    => filename,
  :body   => File.open("cv_uploads/provider_cvs/"+filename),
  :public => true
)
end

at run time I get the following error:

getaddrinfo: nodename nor servname provided, or not known (SocketError)
4

1 回答 1

1

此问题可能是由于使用了不正确的区域造成的。Carrierwave/Fog 默认为“us-east-1”,这不一定是您的正确区域。要解决此问题,请在 AWS 上查找您的区域(这将不是像“Ireland”这样的国家名称,而是像“eu-west-1”这样的区域),然后修改您的配置文件以包含以下内容:

 :region => 'eu-west-1', #or whatever your region is
于 2015-02-11T19:44:04.053 回答