diff --git a/openedx/core/djangoapps/ace_common/settings/common.py b/openedx/core/djangoapps/ace_common/settings/common.py index 9dd0962b2d3a..993412f392bb 100644 --- a/openedx/core/djangoapps/ace_common/settings/common.py +++ b/openedx/core/djangoapps/ace_common/settings/common.py @@ -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) diff --git a/openedx/core/djangoapps/ace_common/settings/production.py b/openedx/core/djangoapps/ace_common/settings/production.py index 0d128850f536..d0076eafc3bd 100644 --- a/openedx/core/djangoapps/ace_common/settings/production.py +++ b/openedx/core/djangoapps/ace_common/settings/production.py @@ -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')