Skip to content

Commit

Permalink
return config key
Browse files Browse the repository at this point in the history
  • Loading branch information
vladbyk89 committed Aug 20, 2024
1 parent f2aa80b commit afdbc4c
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions src/controllers/db/configKey.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
const mode = import.meta.env.VITE_APP_ENV as 'development' | 'production';

const firebaseConfig = {
development: {
apiKey: import.meta.env.VITE_FIREBASE_API_KEY_DEV,
authDomain: import.meta.env.VITE_FIREBASE_AUTH_DOMAIN_DEV,
databaseURL: import.meta.env.VITE_FIREBASE_DATABASE_URL_DEV,
projectId: import.meta.env.VITE_FIREBASE_PROJECT_ID_DEV,
storageBucket: import.meta.env.VITE_FIREBASE_STORAGE_BUCKET_DEV,
messagingSenderId: import.meta.env.VITE_FIREBASE_MESSAGING_SENDER_ID_DEV,
appId: import.meta.env.VITE_FIREBASE_APP_ID_DEV,
measurementId: import.meta.env.VITE_FIREBASE_MEASUREMENT_ID_DEV,
},
production: {
apiKey: import.meta.env.VITE_FIREBASE_API_KEY_PROD,
authDomain: import.meta.env.VITE_FIREBASE_AUTH_DOMAIN_PROD,
databaseURL: import.meta.env.VITE_FIREBASE_DATABASE_URL_PROD,
projectId: import.meta.env.VITE_FIREBASE_PROJECT_ID_PROD,
storageBucket: import.meta.env.VITE_FIREBASE_STORAGE_BUCKET_PROD,
messagingSenderId: import.meta.env.VITE_FIREBASE_MESSAGING_SENDER_ID_PROD,
appId: import.meta.env.VITE_FIREBASE_APP_ID_PROD,
measurementId: import.meta.env.VITE_FIREBASE_MEASUREMENT_ID_PROD,
},
};

const vapidKeys = {
development: import.meta.env.VITE_FIREBASE_VAPID_KEY_DEV,
production: import.meta.env.VITE_FIREBASE_VAPID_KEY_PROD,
};

export const vapidKey = vapidKeys[mode];

export default firebaseConfig[mode];

0 comments on commit afdbc4c

Please sign in to comment.