-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfirebaseConfig.js
More file actions
26 lines (21 loc) · 1.13 KB
/
firebaseConfig.js
File metadata and controls
26 lines (21 loc) · 1.13 KB
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
import { getApp, getApps, initializeApp } from 'firebase/app';
import { getAuth } from 'firebase/auth';
const firebaseConfig = {
apiKey: process.env.EXPO_PUBLIC_FIREBASE_API_KEY || 'MISSING_FIREBASE_API_KEY',
authDomain: process.env.EXPO_PUBLIC_FIREBASE_AUTH_DOMAIN || 'example.firebaseapp.com',
projectId: process.env.EXPO_PUBLIC_FIREBASE_PROJECT_ID || 'example-project-id',
storageBucket: process.env.EXPO_PUBLIC_FIREBASE_STORAGE_BUCKET || 'example.appspot.com',
messagingSenderId: process.env.EXPO_PUBLIC_FIREBASE_MESSAGING_SENDER_ID || '000000000000',
appId: process.env.EXPO_PUBLIC_FIREBASE_APP_ID || '1:000000000000:web:replace-me',
};
const missingFirebaseConfig = Object.entries(firebaseConfig)
.filter(([, value]) => value.startsWith('MISSING_') || value.includes('example'))
.map(([key]) => key);
if (missingFirebaseConfig.length > 0) {
console.warn(
`Firebase config placeholders are active. Set ${missingFirebaseConfig.join(', ')} in your Expo environment before using auth features.`
);
}
const app = getApps().length > 0 ? getApp() : initializeApp(firebaseConfig);
export const auth = getAuth(app);
export default app;