Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
phoqe opened this issue Nov 27, 2019 · 0 comments · Fixed by #3510
Closed

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

phoqe opened this issue Nov 27, 2019 · 0 comments · Fixed by #3510
Assignees
Labels
polish Small feature requests

Comments

@phoqe
Copy link

phoqe commented Nov 27, 2019

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!
@samtstern samtstern added the polish Small feature requests label Dec 21, 2020
@samtstern samtstern self-assigned this Dec 21, 2020
@samtstern samtstern added this to To do in Fixit - H2 2021 via automation Jul 1, 2021
@samtstern samtstern moved this from To do to In progress in Fixit - H2 2021 Jul 1, 2021
@samtstern samtstern moved this from In progress to Done in Fixit - H2 2021 Jul 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
polish Small feature requests
Projects
Development

Successfully merging a pull request may close this issue.

2 participants