Skip to content

Commit

Permalink
Allow emulators to work offline (MOTD fail) (#4998)
Browse files Browse the repository at this point in the history
* Allow emulators to work offline (MOTD fail)

* Allow process to continue when MOTD fetch fails

* Run prettier on CHANGELOG.md

Co-authored-by: Bryan Kendall <bkend@google.com>
  • Loading branch information
2 people authored and christhompsongoogle committed Sep 30, 2022
1 parent 8231dec commit c0b9771
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/fetchMOTD.ts
Expand Up @@ -3,6 +3,7 @@ import * as semver from "semver";

import { Client } from "./apiv2";
import { configstore } from "./configstore";
import { logger } from "./logger";
import { realtimeOrigin } from "./api";
import * as utils from "./utils";

Expand Down Expand Up @@ -43,10 +44,15 @@ export function fetchMOTD(): void {
} else {
const origin = utils.addSubdomain(realtimeOrigin, "firebase-public");
const c = new Client({ urlPrefix: origin, auth: false });
c.get("/cli.json").then((res) => {
motd = Object.assign({}, res.body);
configstore.set("motd", motd);
configstore.set("motd.fetched", Date.now());
});
c.get("/cli.json")
.then((res) => {
motd = Object.assign({}, res.body);
configstore.set("motd", motd);
configstore.set("motd.fetched", Date.now());
})
.catch((err) => {
utils.logWarning("Unable to fetch the CLI MOTD and remote config.");
logger.debug(`Failed to fetch MOTD ${err}`);
});
}
}

0 comments on commit c0b9771

Please sign in to comment.