diff --git a/firebaseConfig.ts b/firebaseConfig.ts index 862ff46..b931343 100644 --- a/firebaseConfig.ts +++ b/firebaseConfig.ts @@ -3,24 +3,27 @@ import { initializeApp } from "firebase/app"; import { getAnalytics } from "firebase/analytics"; import { getFirestore } from "firebase/firestore"; import { getAuth } from "firebase/auth"; -// TODO: Add SDKs for Firebase products that you want to use -// https://firebase.google.com/docs/web/setup#available-libraries // Your web app's Firebase configuration -// For Firebase JS SDK v7.20.0 and later, measurementId is optional const firebaseConfig = { - apiKey: "AIzaSyCeDw9XuqmaMer6B7URujXFNZ5Af2BbA5k", - authDomain: "inspiregem-a6e2e.firebaseapp.com", - projectId: "inspiregem-a6e2e", - storageBucket: "inspiregem-a6e2e.appspot.com", - messagingSenderId: "64551458816", - appId: "1:64551458816:web:fc32fc26d88102c118e0e5", - measurementId: "G-PTJXZLHGMQ" + apiKey: process.env.NEXT_PUBLIC_FIREBASE_API_KEY, + authDomain: process.env.NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN, + projectId: process.env.NEXT_PUBLIC_FIREBASE_PROJECT_ID, + storageBucket: process.env.NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET, + messagingSenderId: process.env.NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID, + appId: process.env.NEXT_PUBLIC_FIREBASE_APP_ID, + measurementId: process.env.NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID, }; // Initialize Firebase const app = initializeApp(firebaseConfig); -const analytics = getAnalytics(app); + +// Check if running in the browser before initializing analytics +let analytics; +if (typeof window !== 'undefined') { + analytics = getAnalytics(app); +} + const db = getFirestore(app); const auth = getAuth(app);