Skip to content

No option to spare storage.rules file from being overwritten in firebase init #1833

Closed

Description

@phoqe

I can submit a PR for this but I’m currently at work, if someone else wants to take a look, be my guest.

Files of interest:
https://github.com/firebase/firebase-tools/blob/master/src/init/features/firestore/rules.ts
https://github.com/firebase/firebase-tools/blob/master/src/init/features/storage.ts

[REQUIRED] Environment info

firebase-tools: 7.8.1

Platform: macOS

[REQUIRED] Test case

N/A

[REQUIRED] Steps to reproduce

These steps assumes that there is a pre-existing firestore.rules and storage.rules file.

  1. Run firebase init
  2. Select Firestore and Storage
  3. Use whatever project
  4. Press Enter to use file firestore.rules for Firestore Rules.
  5. Note that it is asking whether or not to overwrite it since there is already an existing one.
  6. Press Enter for firestore.indexes.json
  7. Press Enter to use file storage.rules for Storage Rules
  8. Note that there is no prompt asking whether or not to overwrite it, it just overwrites it regardless.

[REQUIRED] Expected behavior

Expected behaviour is to ask the user whether or not to overwrite storage.rules if there is an existing storage.rules file present.

[REQUIRED] Actual behavior

No prompt is shown, the file is overwritten regardless of what the user wants.

[2019-11-27T13:35:43.820Z] ----------------------------------------------------------------------
[2019-11-27T13:35:43.822Z] Command:       /usr/local/Cellar/node/13.2.0/bin/node /usr/local/bin/firebase init --debug
[2019-11-27T13:35:43.822Z] CLI Version:   7.8.1
[2019-11-27T13:35:43.822Z] Platform:      darwin
[2019-11-27T13:35:43.822Z] Node Version:  v13.2.0
[2019-11-27T13:35:43.823Z] Time:          Wed Nov 27 2019 14:35:43 GMT+0100 (Central European Standard Time)
[2019-11-27T13:35:43.823Z] ----------------------------------------------------------------------
[2019-11-27T13:35:43.823Z] 
[2019-11-27T13:35:43.828Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
[2019-11-27T13:35:43.828Z] > authorizing via signed-in user

     ######## #### ########  ######## ########     ###     ######  ########
     ##        ##  ##     ## ##       ##     ##  ##   ##  ##       ##
     ######    ##  ########  ######   ########  #########  ######  ######
     ##        ##  ##    ##  ##       ##     ## ##     ##       ## ##
     ##       #### ##     ## ######## ########  ##     ##  ######  ########

You're about to initialize a Firebase project in this directory:

  /Users/phoqe/WebstormProjects/react-material-ui-firebase

? Which Firebase CLI features do you want to set up for this folder? Press Space
 to select features, then Enter to confirm your choices. Firestore: Deploy rules
 and create indexes for Firestore, Storage: Deploy Cloud Storage security rules

=== Project Setup

First, let's associate this project directory with a Firebase project.
You can create multiple project aliases by running firebase use --add, 
but for now we'll just set up a default project.

? Please select an option: Use an existing project
[2019-11-27T13:35:54.434Z] >>> HTTP REQUEST GET https://firebase.googleapis.com/v1beta1/projects?pageSize=100  
 
[2019-11-27T13:35:54.954Z] <<< HTTP RESPONSE 200 content-type=application/json; charset=UTF-8, vary=X-Origin, Referer, Origin,Accept-Encoding, date=Wed, 27 Nov 2019 13:35:54 GMT, server=ESF, cache-control=private, x-xss-protection=0, x-frame-options=SAMEORIGIN, x-content-type-options=nosniff, alt-svc=quic=":443"; ma=2592000; v="46,43",h3-Q050=":443"; ma=2592000,h3-Q049=":443"; ma=2592000,h3-Q048=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000, accept-ranges=none, transfer-encoding=chunked
? Select a default Firebase project for this directory: react-material-ui-fireba
se (React Material-UI Firebase)
i  Using project react-material-ui-firebase (React Material-UI Firebase)

=== Firestore Setup
[2019-11-27T13:35:56.033Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
[2019-11-27T13:35:56.033Z] > authorizing via signed-in user
[2019-11-27T13:35:56.033Z] [iam] checking project react-material-ui-firebase for permissions ["firebase.projects.get"]
[2019-11-27T13:35:56.033Z] >>> HTTP REQUEST POST https://cloudresourcemanager.googleapis.com/v1/projects/react-material-ui-firebase:testIamPermissions  
 permissions=[firebase.projects.get]
[2019-11-27T13:35:57.005Z] <<< HTTP RESPONSE 200 content-type=application/json; charset=UTF-8, vary=X-Origin, Referer, Origin,Accept-Encoding, date=Wed, 27 Nov 2019 13:35:56 GMT, server=ESF, cache-control=private, x-xss-protection=0, x-frame-options=SAMEORIGIN, x-content-type-options=nosniff, server-timing=gfet4t7; dur=849, alt-svc=quic=":443"; ma=2592000; v="46,43",h3-Q050=":443"; ma=2592000,h3-Q049=":443"; ma=2592000,h3-Q048=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000, accept-ranges=none, transfer-encoding=chunked

Firestore Security Rules allow you to define how and when to allow
requests. You can keep these rules in your project directory
and publish them with firebase deploy.

? What file should be used for Firestore Rules? firestore.rules
? File firestore.rules already exists. Do you want to overwrite it with the Fire
store Rules from the Firebase Console? No

Firestore indexes allow you to perform complex queries while
maintaining performance that scales with the size of the result
set. You can keep index definitions in your project directory
and publish them with firebase deploy.

? What file should be used for Firestore indexes? firestore.indexes.json
[2019-11-27T13:36:00.737Z] >>> HTTP REQUEST GET https://firestore.googleapis.com/v1beta2/projects/react-material-ui-firebase/databases/(default)/collectionGroups/-/indexes  
 
[2019-11-27T13:36:00.737Z] >>> HTTP REQUEST GET https://firestore.googleapis.com/v1beta2/projects/react-material-ui-firebase/databases/(default)/collectionGroups/-/fields?filter=indexConfig.usesAncestorConfig=false  
 
[2019-11-27T13:36:00.978Z] <<< HTTP RESPONSE 200 content-type=application/json; charset=UTF-8, vary=X-Origin, Referer, Origin,Accept-Encoding, date=Wed, 27 Nov 2019 13:36:00 GMT, server=ESF, cache-control=private, x-xss-protection=0, x-frame-options=SAMEORIGIN, x-content-type-options=nosniff, alt-svc=quic=":443"; ma=2592000; v="46,43",h3-Q050=":443"; ma=2592000,h3-Q049=":443"; ma=2592000,h3-Q048=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000, accept-ranges=none, transfer-encoding=chunked
[2019-11-27T13:36:00.985Z] <<< HTTP RESPONSE 200 content-type=application/json; charset=UTF-8, vary=X-Origin, Referer, Origin,Accept-Encoding, date=Wed, 27 Nov 2019 13:36:00 GMT, server=ESF, cache-control=private, x-xss-protection=0, x-frame-options=SAMEORIGIN, x-content-type-options=nosniff, alt-svc=quic=":443"; ma=2592000; v="46,43",h3-Q050=":443"; ma=2592000,h3-Q049=":443"; ma=2592000,h3-Q048=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000, accept-ranges=none, transfer-encoding=chunked

=== Storage Setup

Firebase Storage Security Rules allow you to define how and when to allow
uploads and downloads. You can keep these rules in your project directory
and publish them with firebase deploy.

? What file should be used for Storage Rules? storage.rules

i  Writing configuration info to firebase.json...
i  Writing project information to .firebaserc...

✔  Firebase initialization complete!

Activity

  1. added
    polish
    on Dec 21, 2020
  2. self-assigned this
    on Dec 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

polish

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions