Skip to content

Commit d3f3a83

Browse files
committed
refactor: remove unnecessary json parse
1 parent 0c4352e commit d3f3a83

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

backend/src/init/firebase-admin.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import admin, { type ServiceAccount } from "firebase-admin";
1+
import admin from "firebase-admin";
22
import Logger from "../utils/logger";
3-
import { readFileSync, existsSync } from "fs";
3+
import { existsSync } from "fs";
44
import MonkeyError from "../utils/error";
55
import path from "path";
66
import { isDevEnvironment } from "../utils/misc";
@@ -24,14 +24,8 @@ export function init(): void {
2424
);
2525
}
2626
} else {
27-
const serviceAccount = JSON.parse(
28-
readFileSync(SERVICE_ACCOUNT_PATH, {
29-
encoding: "utf8",
30-
flag: "r",
31-
})
32-
) as ServiceAccount;
3327
admin.initializeApp({
34-
credential: admin.credential.cert(serviceAccount),
28+
credential: admin.credential.cert(SERVICE_ACCOUNT_PATH),
3529
});
3630
Logger.success("Firebase app initialized");
3731
}

0 commit comments

Comments
 (0)