wrbapp/frontend/server/utils/firebase.js
Xeovalyte 388d989229
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
fixed firebase admin error
2023-01-22 17:37:10 +01:00

29 lines
1.0 KiB
JavaScript

import { initializeApp, cert } from 'firebase-admin/app';
import { getFirestore } from 'firebase-admin/firestore';
import { getMessaging } from 'firebase-admin/messaging';
import { getAuth } from 'firebase-admin/auth'
const config = useRuntimeConfig()
console.log('testing', config)
export const app = initializeApp({
credential: cert({
"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();
export const messaging = getMessaging();
export const auth = getAuth()