It would be great to have the ability to specify a firebase.json path in the CLI, and with this have the option to have multiple firebase config files.
example usecase:
I want to separate my functions into production and dev groups, since I have a couple of functions that are dev only for now. Since deploy is handled by a CI and I have hosting rewrite rules in my firebase.json, I would specify a production firebase json and a dev firebase json with their appropriate rules
exports.productionGroup = {
function1: functions.exampleFunction1
};
exports.devGroup = {
function1: functions.exampleFunction1,
function2: functions.exampleFunction2
};
prod.firebase.json
{
"hosting": {
"public": "public",
"rewrites": [
{
"source": "/api/exampleFunction1", "function": "productionGroup-exampleFunction1"
}
]
}
}
dev.firebase.json
{
"hosting": {
"public": "public",
"rewrites": [
{
"source": "/api/exampleFunction1", "function": "devGroup-exampleFunction1"
},
{
"source": "/api/exampleFunction2", "function": "devGroup-exampleFunction2"
}
]
}
}
To deploy:
firebase deploy --config dev.firebase.json
or
firebase deploy --config prod.firebase.json
See #590 for some workarounds.
+1 , It is really needed on Monorepos
I also want this.
So, for the time being, I implement predeploy.sh wihch overwrites firestore.rules based on $GCLOUD_PROJECT.
https://firebase.google.com/docs/cli/?hl=en#environment_variables
I'm working on a PR for this issue, but I see that there is still something missing for my initial suggested usecase to work. So I created a new issue #1125 to isolate part of the problem
Good news everyone! I got this approved by the API council so we're going to add a --config / -c flag to the Firebase CLI.
Most helpful comment
Good news everyone! I got this approved by the API council so we're going to add a
--config/-cflag to the Firebase CLI.