Skip to content

Commit

Permalink
refactor(developer): migrate to config
Browse files Browse the repository at this point in the history
  • Loading branch information
steveoh committed Aug 9, 2024
1 parent 17eeade commit cdc8ee8
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 26 deletions.
7 changes: 1 addition & 6 deletions .github/workflows/push.developer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 1 addition & 6 deletions .github/workflows/release.developer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 1 addition & 6 deletions src/developer/.env
Original file line number Diff line number Diff line change
@@ -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=
21 changes: 13 additions & 8 deletions src/developer/src/main.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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(
<QueryClientProvider
client={
Expand All @@ -30,7 +35,7 @@ ReactDOM.createRoot(document.getElementById('root')).render(
}
>
<React.StrictMode>
<FirebaseAppProvider firebaseConfig={config}>
<FirebaseAppProvider firebaseConfig={firebaseConfig}>
<FirebaseContainer>
<App />
<ReactQueryDevtools />
Expand Down

0 comments on commit cdc8ee8

Please sign in to comment.