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