diff --git a/basedosdados_api/account/templates/account/password_reset_email_v1.html b/basedosdados_api/account/templates/account/password_reset_email_v1.html index 386c4b5e..005f8f76 100644 --- a/basedosdados_api/account/templates/account/password_reset_email_v1.html +++ b/basedosdados_api/account/templates/account/password_reset_email_v1.html @@ -47,7 +47,7 @@

Redefinir minha senha - +

Se você não fez essa solicitação, ignore este e-mail. A sua senha atual continuará válida e segura. Caso tenha alguma dúvida ou precise de suporte, entre em contato através do e-mail diff --git a/basedosdados_api/api/v1/admin.py b/basedosdados_api/api/v1/admin.py index fc8e7d04..28a3454b 100644 --- a/basedosdados_api/api/v1/admin.py +++ b/basedosdados_api/api/v1/admin.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- -import json +from json import loads +from pathlib import Path from time import sleep from django import forms @@ -216,8 +217,14 @@ class CoverageTableInline(admin.StackedInline): def get_credentials(): """Get google cloud credentials""" - credentials_dict = json.loads(settings.GOOGLE_APPLICATION_CREDENTIALS) - credentials = service_account.Credentials.from_service_account_info(credentials_dict) + creds_env = settings.GOOGLE_APPLICATION_CREDENTIALS + try: + creds_path = Path(creds_env) + assert creds_path.is_absolute() or creds_path.is_relative_to(".") + credentials = service_account.Credentials.from_service_account_file(creds_path) + except (TypeError, ValueError): + credentials_dict = loads(creds_env) + credentials = service_account.Credentials.from_service_account_info(credentials_dict) return credentials diff --git a/basedosdados_api/settings/dev.py b/basedosdados_api/settings/dev.py index 1c9d53c2..5926ff38 100644 --- a/basedosdados_api/settings/dev.py +++ b/basedosdados_api/settings/dev.py @@ -42,3 +42,6 @@ # Logging setup_logger(level="DEBUG", serialize=False) + +# Google Application Credentials +GOOGLE_APPLICATION_CREDENTIALS = getenv("GOOGLE_APPLICATION_CREDENTIALS", "")