21 lines
530 B
JavaScript
21 lines
530 B
JavaScript
import { initializeApp, cert, getApps } from "firebase-admin/app";
|
|
import { getDatabase } from "firebase-admin/database";
|
|
import { getAuth } from "firebase-admin/auth";
|
|
|
|
import env from "./env.js";
|
|
|
|
if (getApps().length === 0) {
|
|
initializeApp({
|
|
credential: cert({
|
|
projectId: env.firebase.projectId,
|
|
clientEmail: env.firebase.clientEmail,
|
|
privateKey: env.firebase.privateKey,
|
|
}),
|
|
databaseURL: env.firebase.databaseURL,
|
|
});
|
|
}
|
|
|
|
const db = getDatabase();
|
|
const auth = getAuth();
|
|
|
|
export { db, auth }; |