Search code examples
google-signinfirebase-hostingflutter-web

Flutter web app with different Firebase projects


I do have one Flutter web app, but because of our workflow we use multiple Firebase projects (dev, stage, prod) for hosting. This wouldn't be a big deal, if I don't need different index.html file.

Sadly we use Google SignIn and this will need a meta google-signin-client_id key. This differs between the projects.

What's the best practice to setup this project, so a CI/CD can deploy it without any changes to the index.html before upload? Is this even possible yet?


Solution

  • My own solution, that I found somewhere:

    • create flavor folders (eg. /web_flavors/dev and /web_flavors/prod)
    • create a script, which copy the index.html from that flavor folders into /web before the compile

    This way you will always have the right configuration within you build pipeline.

    My only "problem" is, that I have to maintain the two files, if I need more HTML/JScript code in the index.html.