Skip to content

Commit

Permalink
Update environment variables
Browse files Browse the repository at this point in the history
  • Loading branch information
guanquann committed Sep 21, 2024
1 parent 25acf98 commit 2589987
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,3 @@ dist-ssr

# Environment files
.env
firebase.json
6 changes: 6 additions & 0 deletions backend/question-service/.env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
MONGO_URI=MONGO_URI

FIREBASE_PROJECT_ID=FIREBASE_PROJECT_ID
FIREBASE_PRIVATE_KEY=-FIREBASE_PRIVATE_KEY
FIREBASE_CLIENT_EMAIL=FIREBASE_CLIENT_EMAIL
FIREBASE_STORAGE_BUCKET=FIREBASE_STORAGE_BUCKET
9 changes: 6 additions & 3 deletions backend/question-service/config/firebase.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import admin from "firebase-admin";
import serviceAccount from "../firebase.json";

admin.initializeApp({
credential: admin.credential.cert(serviceAccount as admin.ServiceAccount),
storageBucket: "gs://peerprep-c3bd1.appspot.com",
credential: admin.credential.cert({
projectId: process.env.FIREBASE_PROJECT_ID,
privateKey: process.env.FIREBASE_PRIVATE_KEY?.replace(/\\n/g, "\n"),
clientEmail: process.env.FIREBASE_CLIENT_EMAIL,
} as admin.ServiceAccount),
storageBucket: process.env.FIREBASE_STORAGE_BUCKET,
});

const bucket = admin.storage().bucket();
Expand Down

0 comments on commit 2589987

Please sign in to comment.