GSI - Employe Self Service Mobile
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.

42 lines
1.8 KiB

2 months ago
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.command = void 0;
  4. const clc = require("colorette");
  5. const command_1 = require("../command");
  6. const logger_1 = require("../logger");
  7. const requirePermissions_1 = require("../requirePermissions");
  8. const projectUtils_1 = require("../projectUtils");
  9. const functionsConfig = require("../functionsConfig");
  10. const runtimeconfig = require("../gcp/runtimeconfig");
  11. const utils = require("../utils");
  12. const error_1 = require("../error");
  13. exports.command = new command_1.Command("functions:config:unset [keys...]")
  14. .description("unset environment config at the specified path(s)")
  15. .before(requirePermissions_1.requirePermissions, [
  16. "runtimeconfig.configs.list",
  17. "runtimeconfig.configs.create",
  18. "runtimeconfig.configs.get",
  19. "runtimeconfig.configs.update",
  20. "runtimeconfig.configs.delete",
  21. "runtimeconfig.variables.list",
  22. "runtimeconfig.variables.create",
  23. "runtimeconfig.variables.get",
  24. "runtimeconfig.variables.update",
  25. "runtimeconfig.variables.delete",
  26. ])
  27. .before(functionsConfig.ensureApi)
  28. .action(async (args, options) => {
  29. if (!args.length) {
  30. throw new error_1.FirebaseError("Must supply at least one key");
  31. }
  32. const projectId = (0, projectUtils_1.needProjectId)(options);
  33. const parsed = functionsConfig.parseUnsetArgs(args);
  34. await Promise.all(parsed.map((item) => {
  35. if (item.varId === "") {
  36. return runtimeconfig.configs.delete(projectId, item.configId);
  37. }
  38. return runtimeconfig.variables.delete(projectId, item.configId, item.varId);
  39. }));
  40. utils.logSuccess("Environment updated.");
  41. logger_1.logger.info(`\nPlease deploy your functions for the change to take effect by running ${clc.bold("firebase deploy --only functions")}\n`);
  42. });