No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

storage.js 1.3KB

123456789101112131415161718192021222324252627
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.doSetup = void 0;
  4. const clc = require("colorette");
  5. const fs = require("fs");
  6. const logger_1 = require("../../logger");
  7. const prompt_1 = require("../../prompt");
  8. const ensureCloudResourceLocation_1 = require("../../ensureCloudResourceLocation");
  9. const RULES_TEMPLATE = fs.readFileSync(__dirname + "/../../../templates/init/storage/storage.rules", "utf8");
  10. async function doSetup(setup, config) {
  11. setup.config.storage = {};
  12. (0, ensureCloudResourceLocation_1.ensureLocationSet)(setup.projectLocation, "Cloud Storage");
  13. logger_1.logger.info();
  14. logger_1.logger.info("Firebase Storage Security Rules allow you to define how and when to allow");
  15. logger_1.logger.info("uploads and downloads. You can keep these rules in your project directory");
  16. logger_1.logger.info("and publish them with " + clc.bold("firebase deploy") + ".");
  17. logger_1.logger.info();
  18. const storageRulesFile = await (0, prompt_1.promptOnce)({
  19. type: "input",
  20. name: "rules",
  21. message: "What file should be used for Storage Rules?",
  22. default: "storage.rules",
  23. });
  24. setup.config.storage.rules = storageRulesFile;
  25. await config.askWriteProjectFile(setup.config.storage.rules, RULES_TEMPLATE);
  26. }
  27. exports.doSetup = doSetup;