Dallas
Dallas

Reputation: 1836

How to have different Cloud Functions files for different firebase user accounts

I have a lot of Cloud Functions I use for work in a file. I'm wondering how I could have another set of Cloud Functions stored in a different place and then upload them to a different project. I know that I can switch the project by doing, firebase use (name), but I'm not sure how to specify which file to upload.

When I deploy it only seems to take what is in /Users/{username}/functions

In short: I would like a directory that uploads to project1, and a different directory that uploads to project2

Upvotes: 2

Views: 64

Answers (1)

Doug Stevenson
Doug Stevenson

Reputation: 317657

When you run firebase init in a new folder, part of the process is attaching it to a Firebase project. You can easily have any number of project workspace folders attached to any number of projects. I personally have dozens of folders attached to dozens of projects across three accounts. You can tell which project an folder is attached to by looking at the .firebaserc file in that folder. It will contain something like this:

{
  "projects": {
    "default": "your-project-id"
  }
}

When you run firebase deploy from there, it will go to the current account's project with the id your-project-id.

The key thing to remember with the Firebase CLI with multiple Google account is this: it can only be logged into one Google account at a time. So if you're trying to manage multiple projects across multiple accounts, you have to firebase logout followed by firebase login with an active browser window logged into the account you want to switch to.

Upvotes: 1

Related Questions