-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpalit-firebase.js
33 lines (27 loc) · 1006 Bytes
/
palit-firebase.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import firebase from 'firebase/app';
import 'firebase/auth';
import 'firebase/database';
import 'firebase/firestore';
import 'firebase/storage';
// navigate to next.config.js to find the value of these properties
const config = {
apiKey: process.env.NEXT_PUBLIC_APIKEY,
authDomain: process.env.NEXT_PUBLIC_AUTHDOMAIN,
databaseURL: process.env.NEXT_PUBLIC_DATABASEURL,
projectId: process.env.NEXT_PUBLIC_PROJECTID,
storageBucket: process.env.NEXT_PUBLIC_STORAGEBUCKET,
messagingSenderId: process.env.NEXT_PUBLIC_MESSAGINGSENDERID,
appId: process.env.NEXT_PUBLIC_APPID,
measurementId: process.env.NEXT_PUBLIC_MEASUREMENTID,
};
// Initialize Firebase (only once)
const app = !firebase.apps.length ? firebase.initializeApp(config) : firebase.app();
// UNCOMMENT CODE BELOW TO ENABLE LOCAL EMULATOR
// const env = process.env.NODE_ENV || 'development';
/* if (env === 'development') {
app.firestore().settings({
host: 'localhost:8080',
ssl: false,
});
} */
export default app;