26 lines
943 B
JavaScript
26 lines
943 B
JavaScript
|
import { createRequire } from 'module';
|
||
|
const require = createRequire(import.meta.url);
|
||
|
const admin = require("firebase-admin");
|
||
|
|
||
|
import { getFirestore } from 'firebase-admin/firestore';
|
||
|
|
||
|
const config = useRuntimeConfig()
|
||
|
|
||
|
export const app = admin.initializeApp({
|
||
|
credential: admin.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();
|