0

I have a single codebase which I have deploying out to 2 firebase projects, dev and prod.

My .firebaserc contains:

{
  "projects": {
    "default": "dev"
  }
}

However, if i type firebase list, i see

┌─────────────────────┬───────────────────────┬─────────────┐
│ Name                │ Project ID / Instance │ Permissions │
├─────────────────────┼───────────────────────┼─────────────┤
│ dev                 │ dev                   │ Owner       │
├─────────────────────┼───────────────────────┼─────────────┤
│ prod (current)      │ prod                  │ Owner       │
└─────────────────────┴───────────────────────┴─────────────┘

I see this is due to the actual project id being stored in ~/.config/configstore/firebase-tools.json:

 "activeProjects": {
      "/mnt/d/testfb": "prod"
  }

I'd like to know the order of precedence in determining the firebase project id to use. I looked at the firebase cli github, but unfortunately I got a bit lost trying to follow the files around.

Is it safe to assume that the firebase-tools.json is the point of truth? If so, what is the purpose of the .firebaserc file?

zkohi
  • 2,486
  • 1
  • 10
  • 20
plusheen
  • 1,128
  • 1
  • 8
  • 23

1 Answers1

0

See https://firebase.google.com/docs/cli/

A .firebaserc file that stores your project aliases.

a .firebaserc file is Only alias settings.

When you select a Firebase project during project initialization, the project's alias is automatically called default. However, to allow project-specific commands to run against a different Firebase project but use the same project directory, run the following command from within your project directory.

firebase use alias_or_projectID Switch between aliases for your project directory

If you have a development project that's for your use only, you can either pass the --project flag with each command or run firebase use projectID without defining the Firebase project an alias.

In case of to set the following code to a .firebaserc.

{
  "projects": {
    "dev": "<dev-project-id>",
    "prod": "<prod-project-id>"
  }
}

You can change the current Firebase project using alias not project id. Like this.

  • firebase use dev
  • firebase use prod

If you run firebase command whitout the --project flag then firebase command will run against the current Firebase project.

Community
  • 1
  • 1
zkohi
  • 2,486
  • 1
  • 10
  • 20