diff --git a/src/lib/Firebase/config.js b/src/lib/Firebase/config.js new file mode 100644 index 0000000..02b2c04 --- /dev/null +++ b/src/lib/Firebase/config.js @@ -0,0 +1,28 @@ + +// we get all our firebase config from the .env file, not included in the repo, so we don't share our API keys. +// then we initialize the app and export the database and storage so we can use them in other files + +import { initializeApp } from 'firebase/app'; +import { getFirestore } from 'firebase/firestore'; +import { getStorage } from 'firebase/storage'; +import { + PUBLIC_FIREBASE_API_KEY, + PUBLIC_FIREBASE_AUTH_DOMAIN, + PUBLIC_FIREBASE_PROJECT_ID, + PUBLIC_FIREBASE_STORAGE_BUCKET, + PUBLIC_FIREBASE_MESSAGING_SENDER_ID, + PUBLIC_FIREBASE_APP_ID +} from '$env/static/public'; + +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 +}; + +const app = initializeApp(firebaseConfig); +export const db = getFirestore(app); +export const storage = getStorage(app); \ No newline at end of file