Skip to content

Commit

Permalink
Load GCP credentials from file or envvar depending on environment.
Browse files Browse the repository at this point in the history
  • Loading branch information
toddbirchard committed Feb 22, 2024
1 parent 6072620 commit 610a6f5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions config.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,11 @@ class Settings(BaseSettings):
ALGOLIA_TABLE_MONTHLY: str = "algolia_searches_month"

# Google Cloud Auth
GOOGLE_CREDENTIALS: str = getenv("GOOGLE_CREDENTIALS")
GOOGLE_CLOUD_PROJECT_NAME: str = getenv("GOOGLE_CLOUD_PROJECT_NAME")
GOOGLE_CLOUD_JSON_FILEPATH: str = getenv("GOOGLE_CLOUD_JSON_FILEPATH")
GOOGLE_CLOUD_CREDENTIALS: Credentials = None
GOOGLE_CLOUD_CREDENTIALS: Credentials = service_account.Credentials.from_service_account_info(
getenv("GOOGLE_CLOUD_CREDENTIALS")
)
if ENVIRONMENT == "production":
GOOGLE_CLOUD_CREDENTIALS: Credentials = service_account.Credentials.from_service_account_file(
GOOGLE_CLOUD_JSON_FILEPATH
Expand Down

0 comments on commit 610a6f5

Please sign in to comment.