Ad

Is There A Way To Write Database Rules Through Firestore's REST API

I want to initialize a Firestore database with a script and so I would like to write to the database rules through a REST API rather than manually.

There is a REST API to edit Firebase Realtime Database security rules. There is also a REST API to interface with Firestore in general. However, I have not found a REST API to edit Cloud Firestore database security rules.

Ad

Answer

The best way is probably to use the firebase-tools node module, which you may already know from using it as the Firebase CLI.

By signing in with login:ci, you can then call various commands from within your CI system, including deploying your Firestore security rules by running or calling firebase deploy --only firestore:rules.

Ad
source: stackoverflow.com
Ad