Cleanup PR

This commit is contained in:
PJ 2022-01-17 13:54:12 +01:00
parent 75bebf4142
commit 61ca207974
No known key found for this signature in database
GPG Key ID: F345964979FA8971
2 changed files with 12 additions and 2 deletions

View File

@ -1,9 +1,11 @@
const got = require("got");
const FormData = require("form-data");
const { isEqual } = require("lodash");
const { calculateElapsedTime, getResponseContent } = require("../utils");
const { calculateElapsedTime, getResponseContent, isPortalModuleEnabled } = require("../utils");
const { SkynetClient, stringToUint8ArrayUtf8, genKeyPairAndSeed } = require("skynet-js");
const MODULE_BLOCKER = 'b'
const skynetClient = new SkynetClient(process.env.SKYNET_PORTAL_API);
const exampleSkylink = "AACogzrAimYPG42tDOKhS3lXZD8YvlF8Q8R17afe95iV2Q";
@ -230,7 +232,7 @@ if (process.env.ACCOUNTS_ENABLED === "true") {
checks.push(accountHealthCheck, accountWebsiteCheck);
}
if (process.env.PORTAL_MODULES && process.env.PORTAL_MODULES.indexOf('b') !== -1) {
if (isPortalModuleEnabled(MODULE_BLOCKER)) {
checks.push(blockerHealthCheck);
}

View File

@ -39,9 +39,17 @@ function ensureValidJSON(object) {
return JSON.parse(stringified);
}
/**
* isPortalModuleEnabled returns true if the given module is enabled
*/
function isPortalModuleEnabled(module) {
return process.env.PORTAL_MODULES && process.env.PORTAL_MODULES.indexOf(module) !== -1
}
module.exports = {
calculateElapsedTime,
getYesterdayISOString,
getResponseContent,
ensureValidJSON,
isPortalModuleEnabled,
};