[英]rackspace private containers via fog gem
I'm looking for someone who can give me some tips - or, ideally, knows where to find a step-by-step guide or something - for working with private rackspace containers (via temp URL) using Fog in a Rails app. 我正在寻找可以给我一些提示的人-或者,理想情况下,知道在哪里可以找到分步指南或其他内容-使用Rails应用程序中的Fog处理私有机架式容器(通过临时URL)。 I've got fairly far using just their documentation, but none of the temp URLs I generate seem to be valid (401 errors). 我仅使用他们的文档就走了很远,但是我生成的所有临时URL似乎都不有效(401错误)。
Anyone have any tips? 有人有提示吗? I know this is fairly vague, but was hoping there might be a comprehensive guide out there or something - wasn't able to find one via googling around. 我知道这是相当模糊的,但是我希望那里可能有一个全面的指南或某些东西-无法通过谷歌搜索找到一个指南。
Thanks! 谢谢!
EDITED 已编辑
So in response to a comment, I tried following the directions from the getting started guide exactly. 因此,为了回应评论,我尝试完全按照入门指南中的指示进行操作 。 When I go to the URL returned by the code below, I get ERR_CONNECTION_REFUSED. 当我转到下面的代码返回的URL时,我得到ERR_CONNECTION_REFUSED。 Any ideas? 有任何想法吗?
require "fog"
@storage = Fog::Storage.new(:rackspace_username => '{myUsername}',
:rackspace_api_key => '{myAPIKey}',
:rackspace_region => '{myRegion}',
:provider => 'Rackspace')
directory = @storage.directories.get('{myContainer}')
directory.public = false
directory.save
file = directory.files.create(
:key => 'somefile.txt',
:body => 'Rackspace is awesome!'
)
account = @storage.account
account.meta_temp_url_key = '{myTempUrlKey}'
account.save
@storage = Fog::Storage.new(:rackspace_username => '{myUsername}',
:rackspace_api_key => '{myAPIKey}',
:rackspace_region => '{myRegion}',
:rackspace_temp_url_key => '{myTempUrlKey}',
:provider => 'Rackspace')
directory = @storage.directories.get('{myContainer}')
file = directory.files.get('somefile.txt')
temp_url = file.url(Time.now.to_i + 1000000)
puts temp_url
SOLVED 解决了
By getting rid of the directory, file, and temp_url variables at the end and instead using 通过消除最后的目录,文件和temp_url变量,而使用
@storage.get_object_https_url('{myContainer}', 'somefile.txt', Time.now + 60)
which was found in the fog source here . 在这里的雾源中发现的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.