The Rackspace Cloud Files Temp URL Key (temp_url_key
) is a random string that acts as a secret salt/hash to create Temp URLS for Cloud Files.
This temp_url_key
only needs to be setup once, by setting up the X-Account-Meta-Temp-Url-Key
in your Cloud Files account. This temp_url_key
should not be shared as it acts as an auth-token/secret/password for creating Temp URLs. The key must only be used by apps you've approved to directly access and create temporary URLs from your Cloud Files account.
- Rackspace Cloud Files Account
- Rackspace Username
- Rackspace Api Key
- OPTIONAL Rackspace Account Region (Dallas (DFW), Chicago (ORD), North Virginia (IAD), Hong Kong (HKG), or Sydney, Australia (SYD)) - Defaults to Chicago (ORD)
- A random string to be used as the
temp_url_key
- Bundler
- Fog
- Download or clone files to any directory
# clone the repository
$ git clone [email protected]:PeopleAndCode/rackspace_cloudfiles_temp_url_key.git
# Run bundle to install dependencies
$ bundle install
The preferred method would be to set system Environment Variables to be called by the ruby script. This way you won't need to manually enter every time, or expose your Rackspace username
, apikey
or temp_url_key
needlessly.
Optionally you can include your Rackspace Cloud Files Account Region (region
- i.e. Dallas (DFW), Chicago (ORD), North Virginia (IAD), Hong Kong (HKG), or Sydney, Australia (SYD)), this will default to Chicago (ORD) if left out. In other words you will only need to include this if you're using a datacenter other than Chicago (ORD).
username
= raykaoapikey
= 123456789102temp_url_key
= aildafju3412@!398123sakfjieregion
= blank - not included, therefore script will default to Chicago (ORD)
# set in a shell file - e.g. ~/.bash_profile
export RACKSPACE_USERNAME=raykao
export RACKSPACE_APIKEY=123456789102
export RACKSPACE_CLOUDFILES_TEMPURL_KEY=aildafju3412@!398123sakfjie
# Absent here:
#
# export RACKSPACE_REGION=ORD
#
# When missing the script will default to Chicago (ORD) as its region
# run script
$ ruby set-temp-key.rb
Alternatively, you can run the script in a termnial and pass in your Rackspace Username (username
), API Key (api_key
) and your Random String (temp_url_key
) as parameters/arguments into the script.
Optionally you can include your Rackspace Cloud Files Account Region (region
- i.e. Dallas (DFW), Chicago (ORD), North Virginia (IAD), Hong Kong (HKG), or Sydney, Australia (SYD)), this will default to Chicago (ORD) if left out. In other words you will only need to include this if you're using a datacenter other than Chicago (ORD).
# command format example
$ruby set-temp-key.rb username apikey temp_url_key region
username
= raykaoapikey
= 123456789102temp_url_key
= aildafju3412@!398123sakfjieregion
= blank - not included, therefore will script default to Chicago (ORD)
# run script
$ ruby set-temp-key.rb raykao 123456789102 aildafju3412@!398123sakfjie