Programmatically Assign Connection Variables to initializeapp()

Viewed 20

I'm trying to allow the user to select which firebase project they connect to. My angularfire connection is made in the main ngmodule as outlined in the documentation:

@NgModule({
  declarations: [...],
  imports: [
    ...
    provideFirebaseApp(() => initializeApp(environment.firebase)), 
    provideAuth(() => getAuth()), 
    provideFirestore(() => getFirestore()), 
    provideStorage(() => getStorage())],
    ...

And that works. However, I don't want to load the connection options from the environment file and instead want the user to be able to choose what set of options they load. I've toyed with APP_INITIALIZER and have been able to load asynchronous data from a file prior to loading the app, however I now understand that, that data cannot be assigned to imports.

Any help or guidance would be greatly appreciated!

0 Answers
Related