wrbapp/frontend/server/utils/firebase.js

29 lines
1.0 KiB
JavaScript
Raw Normal View History

2023-01-22 17:37:10 +01:00
import { initializeApp, cert } from 'firebase-admin/app';
2023-01-21 21:36:22 +01:00
import { getFirestore } from 'firebase-admin/firestore';
2023-01-22 17:37:10 +01:00
import { getMessaging } from 'firebase-admin/messaging';
import { getAuth } from 'firebase-admin/auth'
2023-01-21 21:36:22 +01:00
const config = useRuntimeConfig()
2023-01-22 17:37:10 +01:00
console.log('testing', config)
export const app = initializeApp({
credential: cert({
2023-01-21 21:36:22 +01:00
"project_id": "wrbapp",
"private_key_id": config.privateKeyId,
"private_key": config.privateKey,
"client_email": "firebase-adminsdk-iqgyy@wrbapp.iam.gserviceaccount.com",
"client_id": config.clientId,
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/firebase-adminsdk-iqgyy%40wrbapp.iam.gserviceaccount.com"
})
})
export const firestore = getFirestore()
export const db = getFirestore();
2023-01-22 17:37:10 +01:00
export const messaging = getMessaging();
export const auth = getAuth()