1

I am using carrierwave fog-google configuration for file download and upload to GCS bucket. However, my concern is I wanted to have a signed URL returned from GCS response with some expiration time.

Is there any configuration I need to set which would help me in receiving a response from GCS which will have signed URL and will expire let say after an hour?

class TestUploader < CarrierWave::Uploader::Base

  storage :fog

  def fog_credentials
    {
      :provider => 'google',
      :google_project =>'my project',
      :google_json_key_location =>'myCredentialFile.json'

    }
  end


  def fog_provider
    'fog/google'
  end

  def fog_directory
    '{#bucket-name}'
  end

  def store_dir

    when :File
      "#{file.getpath}/file"
    when :audio
      "#{file.getpath}/audio"
    else
      p " Invalid file "
    end
  end
end

Catherine O
  • 943
  • 1
  • 9
sagar verma
  • 404
  • 4
  • 10
  • 1
    You might want to check this [documentation](https://cloud.google.com/storage/docs/samples/storage-generate-signed-url-v4#storage_generate_signed_url_v4-ruby) on how you can create a signed URL for an object using Cloud Storage libraries. – Catherine O Jul 18 '22 at 02:35

0 Answers0