fix: sensitive data on firebase config
Signed-off-by: pakintada@gmail.com <Pakin>
This commit is contained in:
parent
29a1a82cfb
commit
a10dbbf26c
1 changed files with 33 additions and 0 deletions
33
src/lib/core/client/firebase.ts
Normal file
33
src/lib/core/client/firebase.ts
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
import {
|
||||
PUBLIC_FIREBASE_API_KEY,
|
||||
PUBLIC_FIREBASE_APP_ID,
|
||||
PUBLIC_FIREBASE_AUTH_DOMAIN,
|
||||
PUBLIC_FIREBASE_MESSAGING_SENDER_ID,
|
||||
PUBLIC_FIREBASE_PROJECT_ID,
|
||||
PUBLIC_FIREBASE_STORAGE_BUCKET
|
||||
} from '$env/static/public';
|
||||
import { getApp, getApps, initializeApp } from 'firebase/app';
|
||||
import {
|
||||
browserSessionPersistence,
|
||||
getAuth,
|
||||
GoogleAuthProvider,
|
||||
setPersistence
|
||||
} from 'firebase/auth';
|
||||
import { getFirestore } from 'firebase/firestore';
|
||||
|
||||
const firebaseConfig = {
|
||||
apiKey: PUBLIC_FIREBASE_API_KEY,
|
||||
authDomain: PUBLIC_FIREBASE_AUTH_DOMAIN,
|
||||
projectId: PUBLIC_FIREBASE_PROJECT_ID,
|
||||
storageBucket: PUBLIC_FIREBASE_STORAGE_BUCKET,
|
||||
messagingSenderId: PUBLIC_FIREBASE_MESSAGING_SENDER_ID,
|
||||
appId: PUBLIC_FIREBASE_APP_ID
|
||||
};
|
||||
|
||||
export const app = getApps().length === 0 ? initializeApp(firebaseConfig) : getApp();
|
||||
|
||||
export const auth = getAuth(app);
|
||||
export const db = getFirestore(app);
|
||||
|
||||
await setPersistence(auth, browserSessionPersistence);
|
||||
await setPersistence(auth, browserSessionPersistence);
|
||||
Loading…
Add table
Add a link
Reference in a new issue