fnp
/
wolnelektury.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
4298f79
)
Don't panic about lack of Firebase key.
author
Radek Czajka
<rczajka@rczajka.pl>
Sat, 15 Dec 2018 22:13:59 +0000
(23:13 +0100)
committer
Radek Czajka
<rczajka@rczajka.pl>
Wed, 19 Dec 2018 20:42:27 +0000
(21:42 +0100)
src/push/utils.py
patch
|
blob
|
history
diff --git
a/src/push/utils.py
b/src/push/utils.py
index
cd67f9c
..
6845315
100644
(file)
--- a/
src/push/utils.py
+++ b/
src/push/utils.py
@@
-6,13
+6,18
@@
import firebase_admin
from firebase_admin import credentials, messaging
from django.conf import settings
from firebase_admin import credentials, messaging
from django.conf import settings
-cred = credentials.Certificate(settings.FCM_PRIVATE_KEY_PATH)
-firebase_admin.initialize_app(cred)
+
+cred = None
+if hasattr(settings, 'FCM_PRIVATE_KEY_PATH'):
+ cred = credentials.Certificate(settings.FCM_PRIVATE_KEY_PATH)
+ firebase_admin.initialize_app(cred)
TOPIC = 'wolnelektury'
def send_fcm_push(title, body, image_url=None):
TOPIC = 'wolnelektury'
def send_fcm_push(title, body, image_url=None):
+ if cred is None:
+ return
# See documentation on defining a message payload.
data = {}
# data = {
# See documentation on defining a message payload.
data = {}
# data = {