vrfs-268: changed perf_data uri storage to be the whole URL for reading, instead of the uri path

This commit is contained in:
Jonathan Kolyer 2013-07-30 12:32:13 -05:00
parent b6478d08c8
commit 8eb132600d
1 changed files with 11 additions and 3 deletions

View File

@ -180,14 +180,22 @@ class ApiMusicSessionsController < ApiController
end
if SampleApp::Application.config.storage_type == :fog
uri = @perf_data.uri
s3 = AWS::S3.new(:access_key_id => SampleApp::Application.config.aws_access_key_id,
:secret_access_key => SampleApp::Application.config.aws_secret_access_key)
bucket = s3.buckets[SampleApp::Application.config.aws_bucket]
url = bucket.objects[@perfdata.uri].url_for(:write, :expires => SampleApp::Application.config.perf_data_signed_url_timeout, :'response_content_type' => 'text/csv').to_s
logger.debug("server can upload to url #{url}")
read_url = bucket.objects[uri].url_for(:read,
# :expires => SampleApp::Application.config.perf_data_signed_url_timeout * 90,
:'response_content_type' => 'text/csv').to_s
@perfdata.update_attribute(:uri, read_url)
write_url = bucket.objects[uri].url_for(:write,
:expires => SampleApp::Application.config.perf_data_signed_url_timeout,
:'response_content_type' => 'text/csv').to_s
logger.debug("*** server can upload to url #{write_url}")
redirect_to write_url
redirect_to url
else
if params[:redirected_back].nil? || !params[:redirected_back]
# first time that a client has asked to do a PUT (not redirected back here)