Skip to content

Commit

Permalink
Adding Firebase Emulator example (#562)
Browse files Browse the repository at this point in the history
  • Loading branch information
SKempin authored Oct 12, 2023
1 parent 1c57ed9 commit afb9519
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions website/docs/firebase_setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,35 @@ screen
In case you want to use the different storage fields provided by the CMS, you
need to enable **Firebase Storage**. The default bucket will be used to
save your stored files.

### Firebase Emulator

Use the firebase emulator with `onFirebaseInit`:

```
const onFirebaseInit = async () => {
if (process.env.NODE_ENV === 'development') {
const db = getFirestore();
const auth = getAuth();
connectFirestoreEmulator(db, '127.0.0.1', 8080);
connectAuthEmulator(auth, 'http://127.0.0.1:9099');
}
};
```

```
<FirebaseCMSApp
name={'Demo App'}
authentication={myAuthenticator}
collections={[eventsCollection, usersCollection]}
firebaseConfig={firebaseConfig}
onFirebaseInit={onFirebaseInit}
dateTimeFormat="E d LLL y"
signInOptions={[
{
provider: 'facebook.com',
},
]}
/>
```

0 comments on commit afb9519

Please sign in to comment.