Geetanshu Gulati
Geetanshu Gulati

Reputation: 782

Get all the firestore security rules using firestore command

I am creating a deployment script for firebase where all the indexes and security rules of firestore are fetched and then saved in my firestore.indexes/rules.json and then project is switched and deployed. I know how to read Rules from firebase "firebase firestore:indexes > save.json" which will fetch all the indexes in my firestore and save it But not able to get how to pull all my firestore rules in local file.

Can anyone help me out for this

Upvotes: 3

Views: 1415

Answers (2)

Doug Stevenson
Doug Stevenson

Reputation: 317828

If you run the command firebase init firestore in a new folder (not an existing project folder), it will put all of your indexes and rules in that new workspace.

That said, this is not the most convenient way to get your rules, but it does work. If you're up to writing your own code, there is an API for working with security rules programmatically.

Upvotes: 6

Frank van Puffelen
Frank van Puffelen

Reputation: 600006

firebaser here

There is currently no command in the Firebase CLI to read the security rules from the server. The only way to get your rules right now is to copy them from the Firebase console.

Adding this feature is actively being discussed though, so I highly recommend weighing in by filing a feature request.

Upvotes: 2

Related Questions