From b9d0c947aa18c2470a14d0fbb796459cdf740d9b Mon Sep 17 00:00:00 2001 From: Hoang-Nguyen-Huy Date: Tue, 22 Oct 2024 22:16:03 +0700 Subject: [PATCH] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20security=20issue?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.example | 5 +++++ .gitignore | 7 +++++++ src/firebase.js | 14 +++++++------- 3 files changed, 19 insertions(+), 7 deletions(-) create mode 100644 .env.example diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..f21d51c --- /dev/null +++ b/.env.example @@ -0,0 +1,5 @@ +VITE_FIREBASE_API_KEY=your_api_key +VITE_FIREBASE_AUTH_DOMAIN=your_auth_domain +VITE_FIREBASE_PROJECT_ID=your_project_id +VITE_FIREBASE_STORAGE_BUCKET=your_storage_bucket +VITE_API_BASE_URL=https://your-mockapi-url.com \ No newline at end of file diff --git a/.gitignore b/.gitignore index a547bf3..441cc01 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,10 @@ dist-ssr *.njsproj *.sln *.sw? + +# Environment variables +.env +.env.local +.env.development.local +.env.test.local +.env.production.local \ No newline at end of file diff --git a/src/firebase.js b/src/firebase.js index 62e29a1..4e4281e 100644 --- a/src/firebase.js +++ b/src/firebase.js @@ -8,13 +8,13 @@ import { getAuth } from "firebase/auth"; // Your web app's Firebase configuration // For Firebase JS SDK v7.20.0 and later, measurementId is optional const firebaseConfig = { - apiKey: "AIzaSyCGYw_TG3UpZOox8SlioWPcj6wej07onVA", - authDomain: "fer-lab-da8b3.firebaseapp.com", - projectId: "fer-lab-da8b3", - storageBucket: "fer-lab-da8b3.appspot.com", - messagingSenderId: "625078386291", - appId: "1:625078386291:web:f1ce015a2d380b2cbbf406", - measurementId: "G-642HVRZF5W", + apiKey: import.meta.env.VITE_FIREBASE_API_KEY, + authDomain: import.meta.env.VITE_FIREBASE_AUTH_DOMAIN, + projectId: import.meta.env.VITE_FIREBASE_PROJECT_ID, + storageBucket: import.meta.env.VITE_FIREBASE_STORAGE_BUCKET, + messagingSenderId: import.meta.env.VITE_FIREBASE_MESSAGING_SENDER_ID, + appId: import.meta.env.VITE_FIREBASE_APP_ID, + measurementId: import.meta.env.VITE_FIREBASE_MEASUREMENT_ID, }; // Initialize Firebase