Skip to content

Initialize the config dynamically outside app.module.ts #1095

Closed
@olivier-po

Description

@olivier-po

I'm trying to solve a use case where I need to connect to one database first to get some kind of a token and references of another database and then connect to the second database. I don't know in advance the config of the second database (only the first one). I can't hard code the second one in my app.

So, I need to be able to initialize a config to a firebase database dynamically. I already check #306 and #761 but none is giving me a real answer on how to perform it. And I checked already https://firebase.google.com/docs/configure/ but I would prefer to keep AngularFire2.

I'm using Ionic 3.5 and angularfire2 "4.0.0-rc.1".
I basically need to call AngularFireModule.initializeApp(secondDatabaseConfig) somehow later in my code not in my app.module.ts

Is it possible ? How would you solve it with AngularFire2 ?

I'm even ready to use a usual WebService to get the config to my second database, so I wouldn't need the first connection. But I'm blocked on instantiating the connection to Firebase dynamically.

The idea behind all of it is to provide to each of my customers their own firebase database (for security reasons) but where they all share the same app. The Firebase Java backend has total control of the database and I need to provide this Java backend to all of my customers...

Thank you for your amazing job

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions