MCPcopy Create free account
hub / github.com/monkeytypegame/monkeytype / init

Function init

backend/src/init/firebase-admin.ts:13–34  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

11);
12
13export function init(): void {
14 if (!existsSync(SERVICE_ACCOUNT_PATH)) {
15 if (isDevEnvironment()) {
16 Logger.warning(
17 "Firebase service account key not found! Continuing in dev mode, but authentication will throw errors.",
18 );
19 } else if (process.env["BYPASS_FIREBASE"] === "true") {
20 Logger.warning("BYPASS_FIREBASE is enabled! Running without firebase.");
21 } else {
22 throw new MonkeyError(
23 500,
24 "Firebase service account key not found! Make sure generate a service account key and place it in credentials/serviceAccountKey.json.",
25 "init() firebase-admin.ts",
26 );
27 }
28 } else {
29 admin.initializeApp({
30 credential: admin.credential.cert(SERVICE_ACCOUNT_PATH),
31 });
32 Logger.success("Firebase app initialized");
33 }
34}
35
36function get(): typeof admin {
37 if (admin.apps.length === 0) {

Callers

nothing calls this directly

Calls 1

isDevEnvironmentFunction · 0.90

Tested by

no test coverage detected