Last active
February 17, 2021 22:31
-
-
Save MorenoMdz/78d277945a213e6842b0f9c555e748ab to your computer and use it in GitHub Desktop.
Firebase Local Emulator config file example
This file contains 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/functions"; | |
import "firebase/firestore"; | |
let config = { | |
apiKey: process.env.REACT_APP_FIREBASE_API_KEY, | |
authDomain: process.env.REACT_APP_FIREBASE_AUTH_DOMAIN, | |
databaseURL: process.env.REACT_APP_FIREBASE_DB_URL, | |
projectId: process.env.REACT_APP_FIREBASE_PROJECT_ID, | |
storageBucket: process.env.REACT_APP_FIREBASE_STORAGE_BUCKET, | |
messagingSenderId: process.env.REACT_APP_FIREBASE_MESSAGE_SENDER_ID, | |
appId: process.env.REACT_APP_FIREBASE_APP_ID, | |
measurementId: process.env.REACT_APP_FIREBASE_MEASUREMENT_ID, | |
}; | |
const app = firebase.initializeApp(config); | |
if (window.location.hostname === "localhost") { | |
app.functions().useFunctionsEmulator("http://localhost:5001"); | |
app.auth().useEmulator("http://localhost:9099"); // Here it might need to use the local IP instead | |
app.firestore().settings({ | |
host: "localhost:8080", | |
ssl: false, | |
}); | |
} | |
export default app; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment