Skip to content

Commit

Permalink
Don't throw error if no GOOGLE_APPLICATION_CREDENTIALS set
Browse files Browse the repository at this point in the history
  • Loading branch information
woodthom2 committed May 31, 2024
1 parent f15a92c commit f8995c6
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions harmony_api/core/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,17 @@
SOFTWARE.
"""

import os
import json
import os
from typing import Union

from pydantic import BaseSettings

GOOGLE_APPLICATION_CREDENTIALS = os.getenv("GOOGLE_APPLICATION_CREDENTIALS", {})
GOOGLE_APPLICATION_CREDENTIALS = os.getenv("GOOGLE_APPLICATION_CREDENTIALS", '{}')
if GOOGLE_APPLICATION_CREDENTIALS:
GOOGLE_APPLICATION_CREDENTIALS = json.loads(GOOGLE_APPLICATION_CREDENTIALS)
if GOOGLE_APPLICATION_CREDENTIALS.startswith(
"{"): # only load JSON if it's JSON format
GOOGLE_APPLICATION_CREDENTIALS = json.loads(GOOGLE_APPLICATION_CREDENTIALS)


class Settings(BaseSettings):
Expand Down

0 comments on commit f8995c6

Please sign in to comment.