manifold/web/lib/firebase/init.ts

14 lines
527 B
TypeScript
Raw Normal View History

2021-12-09 22:05:55 +00:00
import { getFirestore } from '@firebase/firestore'
import { initializeApp, getApps, getApp } from 'firebase/app'
2022-03-07 23:43:26 +00:00
import { FIREBASE_CONFIGS } from '../../../common/access'
const ENV = process.env.NEXT_PUBLIC_FIREBASE_ENV ?? 'PROD'
2022-03-07 23:43:26 +00:00
// TODO: Move this to access.ts
2022-03-02 00:36:52 +00:00
export const IS_PRIVATE_MANIFOLD = !['PROD', 'DEV'].includes(ENV)
// @ts-ignore
const firebaseConfig = FIREBASE_CONFIGS[ENV]
2021-12-08 16:42:19 +00:00
// Initialize Firebase
export const app = getApps().length ? getApp() : initializeApp(firebaseConfig)
2021-12-09 22:05:55 +00:00
export const db = getFirestore(app)