Skip to content

Commit

Permalink
feat(updater): Add unnecessary NullUpdateProvider for good measure
Browse files Browse the repository at this point in the history
  • Loading branch information
Hypfer committed Jan 6, 2025
1 parent 2cb8efc commit 1b9dc20
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 GithubValetudoNightlyUpdateProvider = require("./lib/update_provider/GithubValetudoNightlyUpdateProvider");
const GithubValetudoUpdateProvider = require("./lib/update_provider/GithubValetudoUpdateProvider");
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 GithubValetudoNightlyUpdateProvider();
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 ValetudoUpdateProvider = require("./ValetudoUpdateProvider");

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

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

module.exports = NullUpdateProvider;

0 comments on commit 1b9dc20

Please sign in to comment.