2021-12-09 22:05:55 +00:00
|
|
|
import { getFirestore } from '@firebase/firestore'
|
2022-01-21 23:21:46 +00:00
|
|
|
import { initializeApp, getApps, getApp } from 'firebase/app'
|
2022-03-07 23:43:26 +00:00
|
|
|
import { FIREBASE_CONFIGS } from '../../../common/access'
|
2021-12-24 21:06:01 +00:00
|
|
|
|
2022-02-27 07:29:33 +00:00
|
|
|
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)
|
2022-02-27 07:29:33 +00:00
|
|
|
// @ts-ignore
|
|
|
|
const firebaseConfig = FIREBASE_CONFIGS[ENV]
|
2021-12-08 16:42:19 +00:00
|
|
|
// Initialize Firebase
|
2022-01-21 23:21:46 +00:00
|
|
|
export const app = getApps().length ? getApp() : initializeApp(firebaseConfig)
|
|
|
|
|
2021-12-09 22:05:55 +00:00
|
|
|
export const db = getFirestore(app)
|