17

in the docs
https://firebase.google.com/docs/firestore/security/get-started#use_the_firebase_cli

I know i can deploy rules using:

firebase deploy --only firestore:rules

is there a way for me to specify the location of the rules file?

w--
  • 6,427
  • 12
  • 54
  • 92

1 Answers1

20

You cannot specify the rules file location in a command-line flag, but you can set it in firebase.json:

{
  "firestore": {
    "rules": "path/to/your/firestore.rules"
  }
}
Michael Bleigh
  • 25,334
  • 2
  • 79
  • 85
  • 1
    ohh great i'll try this. i'm assuming you meant `rules.js` correct? is there some docs abt what goes into firebase.json? – w-- Jan 26 '18 at 12:46
  • 1
    Actually for firestore it's not `rules.js` or `rules.json` since the language is neither JavaScript nor JSON. We normally call the file `something.rules`. The docs have more information about what is valid. – Sam Stern Jan 26 '18 at 16:28
  • Yup, my bad on the `.json` extension. – Michael Bleigh Jan 26 '18 at 16:55
  • great thanks. is there some documentation i missed abt what goes into firebase.json? would like to learn more about what i can configure here – w-- Jan 27 '18 at 06:19
  • Thanks, I've been looking everywhere for documentation of the firebase.json schema. – myconode Feb 21 '18 at 02:48
  • I have storage security rules written in the console, but don't have a storage.rules file in my project. Is one necessary? or will the rules in the console suffice? I do have firestore.rules in my project. – Andrew Irwin Oct 21 '20 at 07:56