Skip to content

Commit

Permalink
refactor: [AXM-334] Remove exstra variable
Browse files Browse the repository at this point in the history
  • Loading branch information
KyryloKireiev committed Jun 11, 2024
1 parent 9103757 commit a2bc08a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
11 changes: 3 additions & 8 deletions openedx/core/djangoapps/ace_common/settings/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,12 @@ def plugin_settings(settings): # lint-amnesty, pylint: disable=missing-function
# Note: To local development with Firebase, you must set FIREBASE_CREDENTIALS_PATH
# (path to json file with FIREBASE_CREDENTIALS)
# or FIREBASE_CREDENTIALS dictionary.
# AND COMMENT or remove `settings.FIREBASE_APP = None` string below.
settings.FIREBASE_CREDENTIALS_PATH = None
settings.FIREBASE_CREDENTIALS = None
settings.FIREBASE_APP = None

used_firebase_credentials = getattr(settings, 'FIREBASE_CREDENTIALS_PATH', None)
if not used_firebase_credentials:
used_firebase_credentials = getattr(settings, 'FIREBASE_CREDENTIALS', None)

settings.FIREBASE_APP = setup_firebase_app(settings.FIREBASE_CREDENTIALS_PATH or settings.FIREBASE_CREDENTIALS, settings.FCM_APP_NAME)
settings.FIREBASE_APP = setup_firebase_app(used_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
9 changes: 3 additions & 6 deletions openedx/core/djangoapps/ace_common/settings/production.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,9 @@ def plugin_settings(settings):
)
settings.FIREBASE_CREDENTIALS = settings.ENV_TOKENS.get('FIREBASE_CREDENTIALS', settings.FIREBASE_CREDENTIALS)

used_firebase_credentials = settings.FIREBASE_CREDENTIALS_PATH
if not used_firebase_credentials:
used_firebase_credentials = settings.FIREBASE_CREDENTIALS

if used_firebase_credentials:
settings.FIREBASE_APP = setup_firebase_app(used_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)
Expand Down

0 comments on commit a2bc08a

Please sign in to comment.