From cdc8ee8703c6339efc13fed057f20b11541feb91 Mon Sep 17 00:00:00 2001 From: steveoh Date: Fri, 9 Aug 2024 13:13:11 -0600 Subject: [PATCH] refactor(developer): migrate to config --- .github/workflows/push.developer.yml | 7 +------ .github/workflows/release.developer.yml | 7 +------ src/developer/.env | 7 +------ src/developer/src/main.jsx | 21 +++++++++++++-------- 4 files changed, 16 insertions(+), 26 deletions(-) diff --git a/.github/workflows/push.developer.yml b/.github/workflows/push.developer.yml index cc566995..09cb2017 100644 --- a/.github/workflows/push.developer.yml +++ b/.github/workflows/push.developer.yml @@ -75,12 +75,7 @@ jobs: shell: bash run: npm run build env: - VITE_FIREBASE_API_KEY: ${{ secrets.VITE_FIREBASE_API_KEY }} - VITE_FIREBASE_APP_ID: ${{ secrets.VITE_FIREBASE_APP_ID }} - VITE_FIREBASE_AUTH_DOMAIN: ${{ secrets.VITE_FIREBASE_AUTH_DOMAIN }} - VITE_FIREBASE_MESSAGING_SENDER_ID: ${{ secrets.VITE_FIREBASE_MESSAGING_SENDER_ID }} - VITE_FIREBASE_PROJECT_ID: ${{ secrets.VITE_FIREBASE_PROJECT_ID }} - VITE_FIREBASE_STORAGE_BUCKET: ${{ secrets.VITE_FIREBASE_STORAGE_BUCKET }} + VITE_FIREBASE_CONFIG: ${{ secrets.FIREBASE_CONFIG }} VITE_API_EXPLORER_URL: ${{ vars.API_EXPLORER_URL }} - name: 🔢 Get firebase version diff --git a/.github/workflows/release.developer.yml b/.github/workflows/release.developer.yml index 55f33f97..f21aa522 100644 --- a/.github/workflows/release.developer.yml +++ b/.github/workflows/release.developer.yml @@ -74,12 +74,7 @@ jobs: shell: bash run: npm run build env: - VITE_FIREBASE_API_KEY: ${{ secrets.VITE_FIREBASE_API_KEY }} - VITE_FIREBASE_APP_ID: ${{ secrets.VITE_FIREBASE_APP_ID }} - VITE_FIREBASE_AUTH_DOMAIN: ${{ secrets.VITE_FIREBASE_AUTH_DOMAIN }} - VITE_FIREBASE_MESSAGING_SENDER_ID: ${{ secrets.VITE_FIREBASE_MESSAGING_SENDER_ID }} - VITE_FIREBASE_PROJECT_ID: ${{ secrets.VITE_FIREBASE_PROJECT_ID }} - VITE_FIREBASE_STORAGE_BUCKET: ${{ secrets.VITE_FIREBASE_STORAGE_BUCKET }} + VITE_FIREBASE_CONFIG: ${{ secrets.FIREBASE_CONFIG }}} VITE_API_EXPLORER_URL: ${{ vars.API_EXPLORER_URL }} - name: 🔢 Get firebase version diff --git a/src/developer/.env b/src/developer/.env index 4afe0258..dcca9168 100644 --- a/src/developer/.env +++ b/src/developer/.env @@ -1,7 +1,2 @@ -VITE_FIREBASE_API_KEY= -VITE_FIREBASE_APP_ID= -VITE_FIREBASE_AUTH_DOMAIN= -VITE_FIREBASE_MESSAGING_SENDER_ID= -VITE_FIREBASE_PROJECT_ID= -VITE_FIREBASE_STORAGE_BUCKET= +VITE_FIREBASE_CONFIG= VITE_API_EXPLORER_URL= diff --git a/src/developer/src/main.jsx b/src/developer/src/main.jsx index d5d08ae0..4c54eb16 100644 --- a/src/developer/src/main.jsx +++ b/src/developer/src/main.jsx @@ -8,15 +8,20 @@ import FirebaseContainer from './FirebaseContainer.jsx'; import './index.css'; -const config = { - apiKey: import.meta.env.VITE_FIREBASE_API_KEY, - appId: import.meta.env.VITE_FIREBASE_APP_ID, - authDomain: import.meta.env.VITE_FIREBASE_AUTH_DOMAIN, - messagingSenderId: import.meta.env.VITE_FIREBASE_MESSAGING_SENDER_ID, - projectId: import.meta.env.VITE_FIREBASE_PROJECT_ID, - storageBucket: import.meta.env.VITE_FIREBASE_STORAGE_BUCKET, +let firebaseConfig = { + apiKey: '', + authDomain: '', + projectId: '', + storageBucket: '', + messagingSenderId: '', + appId: '', + measurementId: '', }; +if (import.meta.env.VITE_FIREBASE_CONFIG) { + firebaseConfig = JSON.parse(import.meta.env.VITE_FIREBASE_CONFIG); +} + ReactDOM.createRoot(document.getElementById('root')).render( - +