Commit 4b9f4313 authored by Muhammad Dewji's avatar Muhammad Dewji 🐴

update load_gdrive_config to look for GOOGLE_DRIVE_SERVICE_ACCOUNT_KEY env var

parent ace99628
......@@ -109,8 +109,8 @@ class GoogleDriveClient
attr_reader :session
def initialize()
@session = GoogleDrive::Session.from_service_account_key(StringIO.new(ENV['GOOGLE_DRIVE_SERVICE_ACCOUNT_KEY']))
def initialize(config)
@session = GoogleDrive::Session.from_service_account_key(config)
end
def valid_file?(folders, filename, file_size)
......@@ -186,8 +186,7 @@ class ZoomSyncher
def initialize
@client = ZoomClient.new(load_zoom_config)
#@gdrive_client = GoogleDriveClient.new(load_gdrive_config)
@gdrive_client = GoogleDriveClient.new()
@gdrive_client = GoogleDriveClient.new(load_gdrive_config)
end
def sync
......@@ -289,14 +288,15 @@ class ZoomSyncher
# Returns a config object that responds to client_id, etc.:
# https://www.rubydoc.info/gems/google_drive/2.1.1/GoogleDrive%2FSession.from_config
def load_gdrive_config
data =
if ENV['GOOGLE_DRIVE_CONFIG']
ENV['GOOGLE_DRIVE_CONFIG']
if ENV['GOOGLE_DRIVE_SERVICE_ACCOUNT_KEY']
ENV['GOOGLE_DRIVE_SERVICE_ACCOUNT_KEY']
else
File.read('config.json')
end
JSON.parse(data, object_class: OpenStruct)
StringIO.new(data)
end
# Discard any audio or videos that aren't longer than 30 seconds
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment