Skip to content

Commit

Permalink
Disable Firebase Emulator in Production
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasCode92 committed Jan 8, 2025
1 parent 0623180 commit f64731e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
- main
env:
BRANCH_NAME: ${{ github.ref_name }}
VITE_CI: $CI # always set to true
jobs:
lint:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -39,7 +40,7 @@ jobs:
runs-on: ubuntu-latest
needs: test
env:
VITE_API_KEY: $Vite_API_KEY
VITE_API_KEY: $VITE_API_KEY
VITE_AUTH_DOMAIN: $VITE_AUTH_DOMAIN
VITE_PROJECT_ID: $VITE_PROJECT_ID
VITE_STORAGE_BUCKET: $VITE_STORAGE_BUCKET
Expand Down
6 changes: 5 additions & 1 deletion src/utils/firebase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
import firebaseApp from "@/config/firebase";

const FIREBASE_AUTH_EMULATOR = import.meta.env.VITE_FIREBASE_AUTH_EMULATOR_HOST;
const CI = import.meta.env.VITE_CI === "true";

const googleAuthProvider = new GoogleAuthProvider();

Expand All @@ -29,7 +30,10 @@ googleAuthProvider.setCustomParameters({
export const auth = getAuth(firebaseApp);
export const db = getFirestore();

if (FIREBASE_AUTH_EMULATOR) {
console.log(import.meta.env.CI);
console.log("CI", CI);

if (!CI && FIREBASE_AUTH_EMULATOR) {
console.warn(`Using Firebase Auth Emulator on ${FIREBASE_AUTH_EMULATOR}...`);
connectAuthEmulator(auth, "http://" + FIREBASE_AUTH_EMULATOR);
connectFirestoreEmulator(db, "localhost", 8080);
Expand Down

0 comments on commit f64731e

Please sign in to comment.