This repository was archived by the owner on Sep 20, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 195
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
68476e3
commit b8308f7
Showing
6 changed files
with
423 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
firebase-service-account.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
const firebase = require('firebase-admin') | ||
const logger = require('../logger') | ||
|
||
// Firebase Admin SDK | ||
// ref: https://firebase.google.com/docs/reference/admin/node/admin.messaging | ||
let firebaseMessaging | ||
if (process.env.FIREBASE_SERVICE_JSON) { | ||
try { | ||
const firebaseServiceJson = require(process.env.FIREBASE_SERVICE_JSON) | ||
|
||
firebase.initializeApp({ | ||
credential: firebase.credential.cert(firebaseServiceJson), | ||
databaseURL: process.env.FIREBASE_DB_URL | ||
}) | ||
|
||
firebaseMessaging = firebase.messaging() | ||
} catch (error) { | ||
logger.error(`Error trying to configure firebaseMessaging: ${error}`) | ||
} | ||
} else { | ||
logger.warn('Firebase messaging not configured.') | ||
} | ||
|
||
module.exports = firebaseMessaging |
Oops, something went wrong.