How do I deploy Firebase Database Security rules using the command line?

Seth Ladd picture Seth Ladd · Jul 9, 2016 · Viewed 12.4k times · Source

In older versions of Firebase, we could add a rules section to our firebase.json file, and upload new security rules on every deploy.

How do we use the firebase-tools v3 command-line tools to deploy database security rules?

This page says that it's possible: "Rules for Firebase Storage"

This page hints that the command line tools can do it, but firebase --help and firebase deploy --help don't seem to hint at how to do it? (Apologies if I missed it...)

(related: where is the canonical doc for everything that can go into firebase.json? I found it on the old Firebase site, but can't find it via search on the new docs.)

Thanks!

Answer

jpdelatorre picture jpdelatorre · Sep 4, 2016

You can use firebase deploy --only database if you only want to update database rules. It will overwrite your existing rules.

You can check out Firebase CLI Reference for more info