Skip to content

Commit

Permalink
Parse GCP credentials from string.
Browse files Browse the repository at this point in the history
  • Loading branch information
toddbirchard committed Feb 22, 2024
1 parent 610a6f5 commit 782b5e6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion config.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""FastAPI configuration."""

import datetime
import json
from os import getenv, path

from dotenv import load_dotenv
Expand Down Expand Up @@ -60,8 +61,9 @@ class Settings(BaseSettings):
# Google Cloud Auth
GOOGLE_CLOUD_PROJECT_NAME: str = getenv("GOOGLE_CLOUD_PROJECT_NAME")
GOOGLE_CLOUD_JSON_FILEPATH: str = getenv("GOOGLE_CLOUD_JSON_FILEPATH")
GOOGLE_CLOUD_CREDENTIALS_JSON: str = getenv("GOOGLE_CLOUD_CREDENTIALS")
GOOGLE_CLOUD_CREDENTIALS: Credentials = service_account.Credentials.from_service_account_info(
getenv("GOOGLE_CLOUD_CREDENTIALS")
json.load(GOOGLE_CLOUD_CREDENTIALS_JSON)
)
if ENVIRONMENT == "production":
GOOGLE_CLOUD_CREDENTIALS: Credentials = service_account.Credentials.from_service_account_file(
Expand Down

0 comments on commit 782b5e6

Please sign in to comment.