mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) Endpoint to report on the latest version of stable grist-core image
Summary:
New endpoint `/api/version` that returns latest version of stable docker image in format:
```
{"latestVersion":"1.1.12","
updatedAt":"2024-03-06T06:28:25.752337Z","
isCritical":false,
"updateURL":"https://hub.docker.com/r/gristlabs/grist"
}
```
It connects to docker hub API and reads the version from the tag lists endpoint.
Stores telemetry passed from the client such us: current version, deployment type, installationId and others.
Test Plan: Added new test
Reviewers: georgegevoian
Reviewed By: georgegevoian
Differential Revision: https://phab.getgrist.com/D4220
This commit is contained in:
@@ -302,11 +302,26 @@ export async function readFixtureDoc(docName: string) {
|
||||
// a class to store a snapshot of environment variables, can be reverted to by
|
||||
// calling .restore()
|
||||
export class EnvironmentSnapshot {
|
||||
|
||||
public static push() {
|
||||
this._stack.push(new EnvironmentSnapshot());
|
||||
}
|
||||
|
||||
public static pop() {
|
||||
const snapshot = this._stack.pop();
|
||||
if (!snapshot) {
|
||||
throw new Error("EnvironmentSnapshot stack is empty");
|
||||
}
|
||||
snapshot.restore();
|
||||
}
|
||||
|
||||
private static _stack: EnvironmentSnapshot[] = [];
|
||||
|
||||
private _oldEnv: NodeJS.ProcessEnv;
|
||||
|
||||
public constructor() {
|
||||
this._oldEnv = clone(process.env);
|
||||
}
|
||||
|
||||
// Reset environment variables.
|
||||
public restore() {
|
||||
Object.assign(process.env, this._oldEnv);
|
||||
|
||||
Reference in New Issue
Block a user