Skip to content

Commit

Permalink
feat(Updater): Add NullUpdateProvider for good measure (master branch)
Browse files Browse the repository at this point in the history
  • Loading branch information
DGAlexandru committed Jan 8, 2025
1 parent 8a33562 commit 392ffc3
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
4 changes: 3 additions & 1 deletion backend/lib/updater/Updater.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const fs = require("fs");
const GithubNoCloudNightlyUpdateProvider = require("./lib/update_provider/GithubNoCloudNightlyUpdateProvider");
const GithubNoCloudUpdateProvider = require("./lib/update_provider/GithubNoCloudUpdateProvider");
const Logger = require("../Logger");
const NullUpdateProvider = require("./lib/update_provider/NullUpdateProvider");
const States = require("../entities/core/updater");
const Steps = require("./lib/steps");

Expand Down Expand Up @@ -50,7 +51,8 @@ class Updater {
this.updateProvider = new GithubNoCloudNightlyUpdateProvider();
break;
default:
throw new Error(`Invalid UpdateProvider ${updaterConfig.updateProvider.type}`);
Logger.error(`Invalid UpdateProvider ${updaterConfig.updateProvider.type}`);
this.updateProvider = new NullUpdateProvider();
}

if (updaterConfig.enabled === true) {
Expand Down
20 changes: 20 additions & 0 deletions backend/lib/updater/lib/update_provider/NullUpdateProvider.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const NoCloudUpdateProvider = require("./NoCloudUpdateProvider");

class NullUpdateProvider extends NoCloudUpdateProvider {
/**
* @return {Promise<Array<import("./NoCloudRelease")>>}
*/
async fetchReleases() {
return [];
}

/**
* @param {import("./NoCloudRelease")} release
* @return {Promise<Array<import("./NoCloudReleaseBinary")>>}
*/
async fetchBinariesForRelease(release) {
return [];
}
}

module.exports = NullUpdateProvider;

0 comments on commit 392ffc3

Please sign in to comment.