-
Notifications
You must be signed in to change notification settings - Fork 0
/
admin.js
26 lines (23 loc) · 867 Bytes
/
admin.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/* eslint-disable no-undef */
const admin = require("firebase-admin");
if (process.env.NODE_ENV !== "production") {
require("dotenv").config({ path: "./.env" });
}
const serviceAccount = {
type: "service_account",
project_id: process.env.project_id,
private_key_id: process.env.private_key_id,
private_key: process.env.private_key.replace(/\\n/gm, "\n"),
client_email: process.env.client_email,
client_id: process.env.client_id,
auth_uri: process.env.auth_uri,
token_uri: process.env.token_uri,
auth_provider_x509_cert_url: process.env.auth_provider_x509_cert_url,
client_x509_cert_url: process.env.client_x509_cert_url
};
admin.initializeApp({
credential: admin.credential.cert(serviceAccount),
databaseURL: "https://tabasamunet.firebaseio.com",
});
const db = admin.firestore();
module.exports = { db, admin };