We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a70ec02 commit 4bcbe58Copy full SHA for 4bcbe58
1 file changed
src/server/firebase.ts
@@ -1,11 +1,11 @@
1
-
2
import admin, { ServiceAccount } from 'firebase-admin'
3
-import serviceAccount from '@/../google-services.json' // Update with the path to your key
4
5
-if (!admin.apps.length) {
6
- admin.initializeApp({
7
- credential: admin.credential.cert(serviceAccount as string | ServiceAccount),
8
- })
+const serviceAccount = process.env.GOOGLE_SERVICES_JSON ? JSON.parse(process.env.GOOGLE_SERVICES_JSON) : null
+
+if (!admin.apps.length && serviceAccount) {
+ admin.initializeApp({
+ credential: admin.credential.cert(serviceAccount as ServiceAccount),
+ })
9
}
10
11
export const messaging = admin.messaging()
0 commit comments