Modified paths
This commit is contained in:
+1
-1
@@ -10,4 +10,4 @@ DB_HOST=db
|
||||
DB_PORT=5432
|
||||
EMAIL_API_KEY=
|
||||
GROUP_KEY=
|
||||
GOOGLE_CREDS_JSON='{}'
|
||||
GOOGLE_CREDS='{}'
|
||||
|
||||
@@ -10,8 +10,8 @@ fi
|
||||
if test -f "$DB_PASSWD_FILE"; then
|
||||
export DB_PASSWD=$(cat $DB_PASSWD_FILE)
|
||||
fi
|
||||
if test -f "$GOOGLE_CREDS_JSON"; then
|
||||
export GOOGLE_CREDS_JSON=$(cat $GOOGLE_CRED_JSON_FILE)
|
||||
if test -f "$GOOGLE_CREDS_FILE"; then
|
||||
export GOOGLE_CREDS=$(cat $GOOGLE_CREDS_FILE)
|
||||
fi
|
||||
|
||||
# Collect static files
|
||||
|
||||
+2
-2
@@ -83,9 +83,9 @@ DATABASES = {
|
||||
# Google api settings
|
||||
GROUP_KEY = os.getenv("GROUP_KEY", "")
|
||||
try:
|
||||
GOOGLE_SERVICE_ACCOUNT = json.loads(os.getenv("GOOGLE_CREDS_JSON", "{}"))
|
||||
GOOGLE_CREDS_JSON = json.loads(os.getenv("GOOGLE_CREDS", "{}"))
|
||||
except:
|
||||
GOOGLE_SERVICE_ACCOUNT = json.loads("{}")
|
||||
GOOGLE_CREDS_JSON = json.loads("{}")
|
||||
|
||||
|
||||
# JWT authentication
|
||||
|
||||
+4
-4
@@ -34,14 +34,14 @@ services:
|
||||
- SECRET_KEY_FILE=/run/secrets/BACKEND_SECRET_KEY
|
||||
- DB_PASSWD_FILE=/run/secrets/BACKEND_DB_PASSWD
|
||||
- EMAIL_API_KEY_FILE=/run/secrets/BACKEND_EMAIL_API_KEY
|
||||
- GOOGLE_CREDS_JSON=/run/secrets/GOOGLE_CREDS_JSON
|
||||
- GOOGLE_CREDS_FILE=/run/secrets/BACKEND_GOOGLE_CREDS
|
||||
|
||||
secrets:
|
||||
- BACKEND_SECRET_KEY
|
||||
- BACKEND_DB_PASSWD
|
||||
- BACKEND_EMAIL_API_KEY
|
||||
- GOOGLE_CREDS_JSON
|
||||
|
||||
- BACKEND_GOOGLE_CREDS
|
||||
|
||||
secrets:
|
||||
BACKEND_SECRET_KEY:
|
||||
external: true
|
||||
@@ -49,5 +49,5 @@ secrets:
|
||||
external: true
|
||||
BACKEND_EMAIL_API_KEY:
|
||||
external: true
|
||||
GOOGLE_CREDS_JSON:
|
||||
BACKEND_GOOGLE_CREDS:
|
||||
external: true
|
||||
|
||||
+2
-2
@@ -25,7 +25,7 @@ from sikweb.settings import (
|
||||
DEFAULT_EMAIL_FROM_ADDR,
|
||||
ENABLE_AUTOMATIC_EMAILS,
|
||||
GROUP_KEY,
|
||||
GOOGLE_SERVICE_ACCOUNT,
|
||||
GOOGLE_CREDS_JSON,
|
||||
)
|
||||
from datetime import timedelta
|
||||
|
||||
@@ -136,7 +136,7 @@ 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_info(
|
||||
info=GOOGLE_SERVICE_ACCOUNT, scopes=SCOPES
|
||||
info=GOOGLE_CREDS_JSON, scopes=SCOPES
|
||||
).with_subject("jas_manager@sahkoinsinoorikilta.fi")
|
||||
|
||||
service = build("admin", "directory_v1", credentials=credentials)
|
||||
|
||||
Reference in New Issue
Block a user