diff --git a/.travis.yml b/.travis.yml index c5ee615..964045a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -33,7 +33,7 @@ after_success: deploy: provider: script - script: bash deploy.sh sartography/testing-communicator + script: bash deploy.sh sartography/uva-covid19-testing-communicator skip_cleanup: true on: all_branches: true diff --git a/communicator/services/firebase_service.py b/communicator/services/firebase_service.py index 1cbddfa..2b8a070 100644 --- a/communicator/services/firebase_service.py +++ b/communicator/services/firebase_service.py @@ -1,7 +1,9 @@ +import json import os - +from google.auth.credentials import Credentials from google.cloud import firestore +from google.oauth2 import service_account from communicator import app from communicator.models.sample import Sample @@ -11,8 +13,11 @@ class FirebaseService(object): """Connects to the Google's Firecloud service to retrieve any records added by the tablets. """ def __init__(self): - resource_path = os.path.join(app.instance_path, 'firestore_service_key.json') - self.db = firestore.Client.from_service_account_json(resource_path) + json_config = json.loads(app.config['FIRESTORE_JSON']) + credentials = service_account.Credentials.from_service_account_info(json_config) + self.db = firestore.Client(project="uva-covid19-testing-kiosk", + credentials= credentials) + def get_samples(self): # Then query for documents diff --git a/config/testing.py b/config/testing.py index 0b4adcd..c26e995 100644 --- a/config/testing.py +++ b/config/testing.py @@ -23,6 +23,8 @@ SQLALCHEMY_DATABASE_URI = environ.get( ) ADMIN_UIDS = ['dhf8r'] + print('### USING TESTING CONFIG: ###') print('SQLALCHEMY_DATABASE_URI = ', SQLALCHEMY_DATABASE_URI) print('TESTING = ', TESTING) +