Repository navigation
Conversation
| function createRuleset(projectId, files) { | ||
| var payload = {source: {files: files}}; | ||
|
|
||
| return api.request('POST', '/v1/projects/' + projectId + '/rulesets', { |
There was a problem hiding this comment.
I prefer to put the version # at the top of the file, so if we need to update API version in the future, it's a simpler change. (See https://github.com/firebase/firebase-tools/blob/master/lib/gcp/cloudfunctions.js#L10)
| module.exports = function(context, options, payload) { | ||
| module.exports = function(context, options) { | ||
| var rulesPath = options.config.get('storage.rules'); | ||
| if (rulesPath) { |
There was a problem hiding this comment.
If rulesPath is not defined, is there a message to the user?
There was a problem hiding this comment.
No, and I don't think we want one (see above comment).
| module.exports = function(context, options) { | ||
| var files = _.get(context, 'storage.rules'); | ||
| if (!files) { | ||
| return RSVP.resolve(); |
There was a problem hiding this comment.
Perhaps add a message saying "No rules to deploy"?
There was a problem hiding this comment.
We don't want to do this, since someone running firebase deploy without having initialized their project for storage wouldn't have expected storage to deploy and the message would just be confusing.
|
|
||
| return gcp.storage.buckets.getDefault(options.project).then(function(defaultBucket) { | ||
| if (!defaultBucket) { | ||
| return utils.reject('Unable to locate your default bucket. Please visit the storage panel in the Firebase console to ensure provisioning.'); |
There was a problem hiding this comment.
"provisioning" is a confusing and overly technical, rephrase?
This takes responsibility for deploying storage rules out of the previous backend server and puts it directly in the CLI. Primarily this is a lift-and-translate of backend code (ping me if you want to see where it came from).
This is groundwork for other ongoing refactorings (specifically resource targets) but should be reviewed independently and can be merged separately.
I wanted to do this first so that the multi-resource config abstraction could be built on a stable foundation.
/cc @samtstern who is working with similar code right now and should be aware of this PR.