Skip to content

Commit

Permalink
Change credential passing
Browse files Browse the repository at this point in the history
  • Loading branch information
michplunkett committed Aug 7, 2024
1 parent 5fa18ea commit 54eefd9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
8 changes: 4 additions & 4 deletions incident_reporting/external/google_logger.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Initialize and set the logging defaults."""

import json
import logging
import sys

Expand All @@ -18,10 +17,11 @@ def init_logger():
if ENV_GCP_CREDENTIALS.endswith(FILE_TYPE_JSON):
logging_client = gcp_logging.Client()
else:
credentials = service_account.Credentials.from_service_account_info(
json.loads(ENV_GCP_CREDENTIALS)
logging_client = gcp_logging.Client(
credentials=service_account.Credentials.from_service_account_info(
ENV_GCP_CREDENTIALS
)
)
logging_client = gcp_logging.Client(credentials=credentials)

logging_client.setup_logging(log_level=logging.INFO)
logging.getLogger().addHandler(logging.StreamHandler(sys.stdout))
8 changes: 3 additions & 5 deletions incident_reporting/external/google_nbd.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""Contains code relating to the Google Cloud Platform Datastore service."""

import gzip
import json
import os
from datetime import date, datetime, timedelta

Expand Down Expand Up @@ -98,11 +97,10 @@ def __init__(self):
if ENV_GCP_CREDENTIALS.endswith(FILE_TYPE_JSON):
self.client = Client()
else:
credentials = service_account.Credentials.from_service_account_info(
json.loads(ENV_GCP_CREDENTIALS)
)
self.client = Client(
credentials=credentials,
credentials=service_account.Credentials.from_service_account_info(
ENV_GCP_CREDENTIALS
),
)

@staticmethod
Expand Down

0 comments on commit 54eefd9

Please sign in to comment.