Last active
October 26, 2022 19:53
-
-
Save mattbajorek/50a2b427484a80b24984a592eef9c0a1 to your computer and use it in GitHub Desktop.
Initializing firebase
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
import { Injectable } from '@nestjs/common'; | |
import * as firebase from 'firebase-admin'; | |
@Injectable() | |
export class NotificationsService { | |
constructor() { | |
// For simplicity these credentials are just stored in the environment | |
// However these should be stored in a key management system | |
const firebaseCredentials = JSON.parse(process.env.FIREBASE_CREDENTIAL_JSON); | |
firebase.initializeApp({ | |
credential: firebase.credential.cert(firebaseCredentials), | |
databaseURL: process.env.FIREBASE_DATABASE_URL, | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment