firebase.js 914 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import { initializeApp} from "firebase/app";
  2. import { getFirestore } from 'firebase/firestore';
  3. import { getAuth } from 'firebase/auth';
  4. import { getStorage } from 'firebase/storage'
  5. import { getDatabase } from 'firebase/database';
  6. const {
  7. REACT_APP_FB_API_KEY: apiKey,
  8. REACT_APP_FB_AUTH_DOMAIN: authDomain,
  9. REACT_APP_FB_DB_URL: databaseURL,
  10. REACT_APP_FB_PROJ_ID: projectId,
  11. REACT_APP_FB_STORAGE: storageBucket,
  12. REACT_APP_FB_SENDER_ID: messagingSenderId,
  13. REACT_APP_FB_APP_ID: appId,
  14. } = process.env;
  15. const config = {
  16. apiKey,
  17. authDomain,
  18. databaseURL,
  19. projectId,
  20. storageBucket,
  21. messagingSenderId,
  22. appId,
  23. };
  24. const firebase = initializeApp(config);
  25. const firestore = getFirestore(firebase);
  26. const auth = getAuth(firebase);
  27. const storage = getStorage(firebase);
  28. const database = getDatabase(firebase);
  29. export {
  30. firestore,
  31. auth,
  32. storage,
  33. database,
  34. };
  35. export default firebase;