I am trying to setup the service-account and storing the credential file inside linux server and storing the path in GOOGLE_APPLICATION_CREDENTIALS
provided by Google.
It is said that Google Cloud Client Libraries use a library called Application Default Credentials (ADC) to automatically find your service account credentials.
https://cloud.google.com/docs/authentication/production
I am using CarrierWave inside this fog:google library to upload and download the files. Could you please assist or share your thoughts how can we use in this libraries.
My CarrierWave uploader implementation is below:
class TestUploader < CarrierWave::Uploader::Base
storage :fog
def fog_credentials
{
:provider => 'google',
:google_project =>'my project',
:google_json_key_location => GOOGLE_APPLICATION_CREDENTIALS
}
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
I tried it but it did not work. Kindly suggest here.