I have set up firestore locally following the firebase docs and I can test firebase functions easily. I would love to develop locally with an local firestore database. In the docs they provide the following code:
// Initialize your Web app as described in the Get started for Web
// Firebase previously initialized using firebase.initializeApp().
var db = firebase.firestore();
if (location.hostname === "localhost") {
db.settings({
host: "localhost:8080",
ssl: false
});
}
How can I do this, if I use reactfire with reactjs to init firebase? Currently its initialised like this:
const firebaseConfig = {
apiKey: "",
authDomain: "example.firebaseapp.com",
databaseURL: "https://example.firebaseio.com",
projectId: "example",
storageBucket: "example.appspot.com",
messagingSenderId: "",
appId: "",
measurementId: ""
};
ReactDOM.render(
<React.StrictMode>
<FirebaseAppProvider firebaseConfig={firebaseConfig}>
<App/>
</FirebaseAppProvider>
</React.StrictMode>,
document.getElementById("root")
);
Should I just manipulate the databaseURL:
in the config or is there another best practice to connect to the local emulator firestore?