Skip to content

Instantly share code, notes, and snippets.

@krames
Created August 13, 2013 18:48
Show Gist options
  • Save krames/6224358 to your computer and use it in GitHub Desktop.
Save krames/6224358 to your computer and use it in GitHub Desktop.
This script file will update X-Account-Meta-Temp-Url-Key which is required to use TempURL. This script assumes that you have the fog gem installed. It can be installed by executing "gem install fog"
require 'fog'
# Please replace these with the approprate values
RACKSPACE_USERNAME = "YOUR USERNAME"
RACKSPACE_API_KEY = "YOUR API KEY"
RACKSPACE_TEMP_URL_KEY = "#192!29jd!23990192DSAF"
puts "Creating Storage Service"
begin
service = Fog::Storage.new :provider => 'rackspace',
:rackspace_username => RACKSPACE_USERNAME,
:rackspace_api_key => RACKSPACE_API_KEY,
:rackspace_region => :ord
service.post_set_meta_temp_url_key RACKSPACE_TEMP_URL_KEY
puts "X-Account-Meta-Temp-Url-Key successfully set to #{RACKSPACE_TEMP_URL_KEY}"
rescue => e
puts "Unable to set X-Account-Meta-Temp-Url-Key - #{e.inspect}"
puts e.backtrace
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment