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

fix version check in remoteconfig:get #3945

Merged
merged 2 commits into from Dec 14, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
@@ -1,4 +1,5 @@
- 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)
- 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