Skip to content

Commit

Permalink
fix version check in remoteconfig:get (#3945)
Browse files Browse the repository at this point in the history
  • Loading branch information
bkendall committed Dec 14, 2021
1 parent 5738912 commit 28df16c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
@@ -1,5 +1,6 @@
- Fixes issue when installing a Firebase Extension where secrets would be created before validation.
- Fixes issue with filtering on a specific storage bucket using functions in the emulator (#3893)
- Fixes issue with filtering on a specific storage bucket using functions in the emulator. (#3893)
- Fixes check in Cloud Functions for Firebase initialization to check for API enablement before trying to enable them. (#2574)
- No longer tries to clean up function build images from Artifact Registry when Artifact Registry is not enabled (#3943)
- Show error message when running `firebase init hosting:github` with no Hosting config in `firebase.json` (#3113)
- Fixes issue where `remoteconfig:get` was not fetching the latest version by default. (#3559)
11 changes: 6 additions & 5 deletions src/commands/remoteconfig-get.ts
Expand Up @@ -12,17 +12,18 @@ import * as utils from "../utils";
import Table = require("cli-table");
import * as fs from "fs";
import util = require("util");
import { FirebaseError } from "../error";

const tableHead = ["Entry Name", "Value"];

// Creates a maximum limit of 50 names for each entry
const MAX_DISPLAY_ITEMS = 20;

function checkValidNumber(versionNumber: string): string {
if (typeof Number(versionNumber) == "number") {
function checkValidOptionalNumber(versionNumber?: string): string | undefined {
if (!versionNumber || typeof Number(versionNumber) == "number") {
return versionNumber;
}
return "null";
throw new FirebaseError(`Could not interpret "${versionNumber}" as a valid number.`);
}

module.exports = new Command("remoteconfig:get")
Expand All @@ -35,10 +36,10 @@ module.exports = new Command("remoteconfig:get")
.before(requireAuth)
.before(requirePermissions, ["cloudconfig.configs.get"])
.action(async (options: Options) => {
utils.assertIsString(options.versionNumber);
utils.assertIsStringOrUndefined(options.versionNumber);
const template: RemoteConfigTemplate = await rcGet.getTemplate(
needProjectId(options),
checkValidNumber(options.versionNumber)
checkValidOptionalNumber(options.versionNumber)
);
const table = new Table({ head: tableHead, style: { head: ["green"] } });
if (template.conditions) {
Expand Down

0 comments on commit 28df16c

Please sign in to comment.