{"size": 1330, "ext": "js", "max_stars_repo_path": "src/firebase.js", "max_stars_repo_name": "writewithocto/octo", "max_stars_repo_stars_event_min_datetime": "2021-03-04T12:49:54.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-17T18:48:17.000Z", "max_issues_repo_path": "src/firebase.js", "max_issues_repo_name": "writewithocto/octo", "max_issues_repo_issues_event_min_datetime": "2021-03-12T01:58:05.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-27T04:38:19.000Z", "max_forks_repo_path": "src/firebase.js", "max_forks_repo_name": "writewithocto/octo", "max_forks_repo_forks_event_min_datetime": "2021-04-04T21:53:11.000Z", "max_forks_repo_forks_event_max_datetime": "2021-09-20T23:31:40.000Z"}
{"max_stars_count": 132, "max_issues_count": 38, "max_forks_count": 7, "avg_line_length": 28.2978723404, "max_line_length": 90, "alphanum_fraction": 0.7947368421}
import firebase from 'firebase/compat/app'
import 'firebase/compat/auth'
import 'firebase/compat/firestore'

// firebase config
const config = {
  apiKey: import.meta.env.VITE_FIREBASE_API_KEY,
  appId: import.meta.env.VITE_FIREBASE_APP_ID,
  authDomain: import.meta.env.VITE_FIREBASE_AUTH_DOMAIN,
  databaseURL: import.meta.env.VITE_FIREBASE_DATABASE_URL,
  messagingSenderId: import.meta.env.VITE_FIREBASE_MESSAGING_SENDER_ID,
  projectId: import.meta.env.VITE_FIREBASE_PROJECT_ID,
  storageBucket: import.meta.env.VITE_FIREBASE_STORAGE_BUCKET,
}

// init firebase
firebase.initializeApp(config)

// utils
export const authInstance = firebase.auth()
export const authNamespace = firebase.auth
export const firestoreInstance = firebase.firestore()
export const firestoreNamespace = firebase.firestore

// use emulators in development
if (location.hostname === 'localhost' && !import.meta.env.VITE_FIREBASE_EMULATOR_BYPASS) {
  authInstance.useEmulator(
    import.meta.env.VITE_FIREBASE_EMULATOR_AUTH,
    {
      disableWarnings: true,
    }
  )

  firestoreInstance.useEmulator(
    import.meta.env.VITE_FIREBASE_EMULATOR_FIRESTORE_HOST,
    import.meta.env.VITE_FIREBASE_EMULATOR_FIRESTORE_PORT,
  )
}

// export firebase instance
export default {
  authInstance,
  authNamespace,
  firestoreInstance,
  firestoreNamespace,
}
