Last active
December 5, 2021 13:03
-
-
Save ZulianTiger/764f77741ade77bda8b9dd48e3411a7e to your computer and use it in GitHub Desktop.
Firebase config for Next.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import firebase from "firebase/app"; | |
import "firebase/auth"; | |
import "firebase/firestore"; | |
import "firebase/app-check"; | |
const CONFIG = { | |
apiKey: process.env.NEXT_PUBLIC_FIREBASE_KEY, | |
authDomain: process.env.NEXT_PUBLIC_FIREBASE_DOMAIN, | |
projectId: process.env.NEXT_PUBLIC_FIREBASE_PROJECT_ID, | |
databaseURL: process.env.NEXT_PUBLIC_FIREBASE_DATABASE_URL, | |
storageBucket: process.env.NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET, | |
messagingSenderId: process.env.NEXT_PUBLIC_FIREBASE_SENDER_ID, | |
appId: process.env.NEXT_PUBLIC_FIREBASE_APP_ID, | |
measurementId: process.env.NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID, | |
}; | |
let app; | |
if (!firebase.apps.length) { | |
firebase.initializeApp(CONFIG); | |
} else { | |
firebase.app(); // if already initialized, use that one | |
} | |
const appCheck = firebase.appCheck(app); | |
export default app; | |
export { app }; | |
export { appCheck }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment