Skip to content

Commit

Permalink
fix:get key from env
Browse files Browse the repository at this point in the history
  • Loading branch information
dev-Roshan-lab committed Jan 19, 2024
1 parent f6a3830 commit 7a6f486
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion python/subscribe_to_topic.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import firebase_admin
from firebase_admin import credentials, messaging
from .utils import key
import os

def main(context):
if 'timetable_app' not in firebase_admin._apps:
key = eval(os.environ['KEY'])
cred = credentials.Certificate(key)
firebase_admin.initialize_app(cred, name='timetable_app')
if (context.req.path == "/"):
return context.res.json({"msg": "working, use /subscribe to register users"})
if (context.req.path == "/subscribe"):
token = context.req.query['token']
response = messaging.subscribe_to_topic(token, "timetable")
Expand Down

0 comments on commit 7a6f486

Please sign in to comment.