Skip to content

Commit

Permalink
feat: [AXM-334] Allow easily adding Firebase credentials in Tutor (#2572
Browse files Browse the repository at this point in the history
)

* feat: [AXM-334] Allow easily adding Firebase credentials in Tutor

* fix: [AXM-334] Fix firebase credentials getting logic

* fix: [AXM-334] Remove extra setting

* fix: [AXM-334] Ivan's changes

* refactor: [AXM-334] Remove extra variable
  • Loading branch information
KyryloKireiev authored Jun 14, 2024
1 parent c3bf3cc commit 8f0a187
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
10 changes: 7 additions & 3 deletions openedx/core/djangoapps/ace_common/settings/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,15 @@ def plugin_settings(settings): # lint-amnesty, pylint: disable=missing-function
settings.FCM_APP_NAME = 'fcm-edx-platform'

settings.ACE_CHANNEL_DEFAULT_PUSH = 'push_notification'
# Note: To local development with Firebase, you must set FIREBASE_CREDENTIALS.
settings.FCM_APP_NAME = 'fcm-edx-platform'
# Note: To local development with Firebase, you must set FIREBASE_CREDENTIALS_PATH
# (path to json file with FIREBASE_CREDENTIALS)
# or FIREBASE_CREDENTIALS dictionary.
settings.FIREBASE_CREDENTIALS_PATH = None
settings.FIREBASE_CREDENTIALS = None

settings.FIREBASE_APP = setup_firebase_app(settings.FIREBASE_CREDENTIALS, settings.FCM_APP_NAME)
settings.FIREBASE_APP = setup_firebase_app(
settings.FIREBASE_CREDENTIALS_PATH or settings.FIREBASE_CREDENTIALS, settings.FCM_APP_NAME
)

if getattr(settings, 'FIREBASE_APP', None):
settings.ACE_ENABLED_CHANNELS.append(settings.ACE_CHANNEL_DEFAULT_PUSH)
Expand Down
8 changes: 7 additions & 1 deletion openedx/core/djangoapps/ace_common/settings/production.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,15 @@ def plugin_settings(settings):
'ACE_CHANNEL_TRANSACTIONAL_EMAIL', settings.ACE_CHANNEL_TRANSACTIONAL_EMAIL
)
settings.FCM_APP_NAME = settings.ENV_TOKENS.get('FCM_APP_NAME', settings.FCM_APP_NAME)
settings.FIREBASE_CREDENTIALS_PATH = settings.ENV_TOKENS.get(
'FIREBASE_CREDENTIALS_PATH', settings.FIREBASE_CREDENTIALS_PATH
)
settings.FIREBASE_CREDENTIALS = settings.ENV_TOKENS.get('FIREBASE_CREDENTIALS', settings.FIREBASE_CREDENTIALS)

settings.FIREBASE_APP = setup_firebase_app(settings.FIREBASE_CREDENTIALS, settings.FCM_APP_NAME)
settings.FIREBASE_APP = setup_firebase_app(
settings.FIREBASE_CREDENTIALS_PATH or settings.FIREBASE_CREDENTIALS, settings.FCM_APP_NAME
)

if settings.FIREBASE_APP:
settings.ACE_ENABLED_CHANNELS.append(settings.ACE_CHANNEL_DEFAULT_PUSH)
settings.ACE_ENABLED_POLICIES.append('bulk_push_notification_optout')
Expand Down

0 comments on commit 8f0a187

Please sign in to comment.