File tree Expand file tree Collapse file tree 2 files changed +15
-4
lines changed
Expand file tree Collapse file tree 2 files changed +15
-4
lines changed Original file line number Diff line number Diff line change 11import {
22 FirebaseApp ,
33 FirebaseError ,
4+ FirebaseOptions ,
45 getApp ,
56 getApps ,
67 initializeApp ,
@@ -21,7 +22,6 @@ import {
2122 indexedDBLocalPersistence ,
2223 getAdditionalUserInfo ,
2324} from "firebase/auth" ;
24- import { firebaseConfig } from "./constants/firebase-config" ;
2525import * as Notifications from "./elements/notifications" ;
2626import {
2727 createErrorMessage ,
@@ -52,6 +52,17 @@ const { promise: authPromise, resolve: resolveAuthPromise } =
5252
5353export async function init ( callback : ReadyCallback ) : Promise < void > {
5454 try {
55+ let firebaseConfig : FirebaseOptions | null ;
56+
57+ const constants = import . meta. glob ( "./constants/*.ts" ) ;
58+ const loader = constants [ "./constants/firebase-config.ts" ] ;
59+ if ( loader ) {
60+ firebaseConfig = ( ( await loader ( ) ) as { firebaseConfig : FirebaseOptions } )
61+ . firebaseConfig ;
62+ } else {
63+ throw new Error ( "No firebase config found." ) ;
64+ }
65+
5566 readyCallback = callback ;
5667 app = getApps ( ) . length === 0 ? initializeApp ( firebaseConfig ) : getApp ( ) ;
5768 Auth = getAuth ( app ) ;
@@ -65,8 +76,6 @@ export async function init(callback: ReadyCallback): Promise<void> {
6576 await callback ( true , user ) ;
6677 }
6778 } ) ;
68-
69- resolveAuthPromise ( ) ;
7079 } catch ( e ) {
7180 app = undefined ;
7281 Auth = undefined ;
@@ -81,6 +90,8 @@ export async function init(callback: ReadyCallback): Promise<void> {
8190 false
8291 ) ;
8392 }
93+ } finally {
94+ resolveAuthPromise ( ) ;
8495 }
8596}
8697
Original file line number Diff line number Diff line change 3232 "start" : " turbo run start" ,
3333 "start-be" : " turbo run start --filter @monkeytype/backend" ,
3434 "start-fe" : " turbo run start --filter @monkeytype/frontend" ,
35- "docker" : " cd backend && docker compose up " ,
35+ "docker" : " cd backend && npm run docker " ,
3636 "audit-fe" : " cd frontend && npm run audit" ,
3737 "release" : " monkeytype-release" ,
3838 "release-fe" : " monkeytype-release --fe" ,
You can’t perform that action at this time.
0 commit comments