mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-10-26 08:47:36 +08:00
refactor: remove unnecessary json parse
This commit is contained in:
parent
0c4352ee5f
commit
d3f3a834e3
1 changed files with 3 additions and 9 deletions
|
|
@ -1,6 +1,6 @@
|
|||
import admin, { type ServiceAccount } from "firebase-admin";
|
||||
import admin from "firebase-admin";
|
||||
import Logger from "../utils/logger";
|
||||
import { readFileSync, existsSync } from "fs";
|
||||
import { existsSync } from "fs";
|
||||
import MonkeyError from "../utils/error";
|
||||
import path from "path";
|
||||
import { isDevEnvironment } from "../utils/misc";
|
||||
|
|
@ -24,14 +24,8 @@ export function init(): void {
|
|||
);
|
||||
}
|
||||
} else {
|
||||
const serviceAccount = JSON.parse(
|
||||
readFileSync(SERVICE_ACCOUNT_PATH, {
|
||||
encoding: "utf8",
|
||||
flag: "r",
|
||||
})
|
||||
) as ServiceAccount;
|
||||
admin.initializeApp({
|
||||
credential: admin.credential.cert(serviceAccount),
|
||||
credential: admin.credential.cert(SERVICE_ACCOUNT_PATH),
|
||||
});
|
||||
Logger.success("Firebase app initialized");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue