Line data Source code
1 : import type { FirebaseOptions } from 'firebase/app'
2 :
3 : import { remoteConfig } from '@/platform/remoteConfig/remoteConfig'
4 :
5 2356 : const DEV_CONFIG: FirebaseOptions = {
6 : apiKey: 'AIzaSyDa_YMeyzV0SkVe92vBZ1tVikWBmOU5KVE',
7 : authDomain: 'dreamboothy-dev.firebaseapp.com',
8 : databaseURL: 'https://dreamboothy-dev-default-rtdb.firebaseio.com',
9 : projectId: 'dreamboothy-dev',
10 : storageBucket: 'dreamboothy-dev.appspot.com',
11 : messagingSenderId: '313257147182',
12 : appId: '1:313257147182:web:be38f6ebf74345fc7618bf',
13 : measurementId: 'G-YEVSMYXSPY'
14 : }
15 :
16 : const PROD_CONFIG: FirebaseOptions = {
17 : apiKey: 'AIzaSyC2-fomLqgCjb7ELwta1I9cEarPK8ziTGs',
18 : authDomain: 'dreamboothy.firebaseapp.com',
19 : databaseURL: 'https://dreamboothy-default-rtdb.firebaseio.com',
20 : projectId: 'dreamboothy',
21 : storageBucket: 'dreamboothy.appspot.com',
22 : messagingSenderId: '357148958219',
23 : appId: '1:357148958219:web:f5917f72e5f36a2015310e',
24 : measurementId: 'G-3ZBD3MBTG4'
25 : }
26 :
27 2356 : const BUILD_TIME_CONFIG = __USE_PROD_CONFIG__ ? PROD_CONFIG : DEV_CONFIG
28 :
29 : /**
30 : * Firebase config for the current backend: the server's firebase_config (cloud builds),
31 : * else the bundled DEV_CONFIG when the server reports a dev-tier backend, else the build-time default.
32 : */
33 2355 : export function getFirebaseConfig(): FirebaseOptions {
34 2355 : const runtimeConfig = remoteConfig.value.firebase_config
35 2355 : if (runtimeConfig) return runtimeConfig
36 2355 : if (remoteConfig.value.firebase_env === 'dev') return DEV_CONFIG
37 2355 : return BUILD_TIME_CONFIG
38 : }
39 :
40 : /** Whether {@link getFirebaseConfig} names the project from the server rather than the build. */
41 0 : export function hasServerFirebaseConfig(): boolean {
42 0 : return (
43 : Boolean(remoteConfig.value.firebase_config) ||
44 : remoteConfig.value.firebase_env === 'dev'
45 : )
46 : }
|