Moved google creds to .env
This commit is contained in:
+1
-2
@@ -11,5 +11,4 @@ node_modules/
|
||||
.idea/
|
||||
*.code-workspace
|
||||
venv/
|
||||
.venv/
|
||||
google-service-cred.json
|
||||
.venv/
|
||||
@@ -15,6 +15,7 @@ import sentry_sdk
|
||||
from sentry_sdk.integrations.django import DjangoIntegration
|
||||
from sikweb.base import *
|
||||
from datetime import timedelta
|
||||
import json
|
||||
|
||||
load_dotenv() # loads the configs from .env
|
||||
|
||||
@@ -81,6 +82,7 @@ DATABASES = {
|
||||
|
||||
# Google api settings
|
||||
GROUP_KEY = os.getenv("GROUP_KEY", "")
|
||||
GOOGLE_SERVICE_ACCOUNT = json.loads(os.getenv("GOOGLE_CREDS_JSON", ""))
|
||||
|
||||
# JWT authentication
|
||||
SIMPLE_JWT = {
|
||||
|
||||
+3
-2
@@ -24,6 +24,7 @@ from sikweb.settings import (
|
||||
DEFAULT_EMAIL_FROM_ADDR,
|
||||
ENABLE_AUTOMATIC_EMAILS,
|
||||
GROUP_KEY,
|
||||
GOOGLE_SERVICE_ACCOUNT,
|
||||
)
|
||||
from datetime import timedelta
|
||||
|
||||
@@ -133,8 +134,8 @@ def add_to_mailinglist(email: str):
|
||||
|
||||
# create credentials, with subject is used to impersonate admin account
|
||||
# jas_manager has groups editor rights in google admin
|
||||
credentials = service_account.Credentials.from_service_account_file(
|
||||
filename=SERVICE_ACCOUNT_FILE, scopes=SCOPES
|
||||
credentials = service_account.Credentials.from_service_account_info(
|
||||
info=GOOGLE_SERVICE_ACCOUNT, scopes=SCOPES
|
||||
).with_subject("jas_manager@sahkoinsinoorikilta.fi")
|
||||
|
||||
service = build("admin", "directory_v1", credentials=credentials)
|
||||
|
||||
Reference in New Issue
Block a user