Skip to content

Commit

Permalink
Merge pull request #13 from SkynetLabs/karol/sky-965-add-resolver-sky…
Browse files Browse the repository at this point in the history
…link-critical-health

add resolver skylink download to critical checks
  • Loading branch information
MSevey committed Jun 27, 2022
2 parents 4e31048 + ed412ee commit d1fbb48
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions src/checks/critical.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ const MODULE_BLOCKER = "b";
const skynetClient = new SkynetClient(`https://${process.env.PORTAL_DOMAIN}`);
const exampleSkylink = "AACogzrAimYPG42tDOKhS3lXZD8YvlF8Q8R17afe95iV2Q";

// this resolver skylink points to latest release of webportal-website and
// is updated automatically on each merged pull request via github-actions
// source: https://github.com/SkynetLabs/webportal-website
const exampleResolverSkylink = "AQCExZYFmmc75OPgjPpHuF4WVN0pc4FX2p09t4naLKfTLw";

// check that any relevant configuration is properly set in skyd
async function skydConfigCheck(done) {
const time = process.hrtime();
Expand Down Expand Up @@ -101,13 +106,20 @@ async function websiteCheck(done) {
return done(await genericAccessCheck("website", `https://${process.env.PORTAL_DOMAIN}`));
}

// downloadCheck returns the result of downloading the hard coded link
async function downloadCheck(done) {
// downloadSkylinkCheck returns the result of downloading the hard coded link
async function downloadSkylinkCheck(done) {
const url = await skynetClient.getSkylinkUrl(exampleSkylink);

return done(await genericAccessCheck("skylink", url));
}

// downloadResolverSkylinkCheck returns the result of downloading an example resolver skylink
async function downloadResolverSkylinkCheck(done) {
const url = await skynetClient.getSkylinkUrl(exampleResolverSkylink);

return done(await genericAccessCheck("resolver_skylink", url));
}

// skylinkSubdomainCheck returns the result of downloading the hard coded link via subdomain
async function skylinkSubdomainCheck(done) {
const url = await skynetClient.getSkylinkUrl(exampleSkylink, { subdomain: true });
Expand Down Expand Up @@ -263,7 +275,8 @@ const checks = [
skydWorkersCooldownCheck,
uploadCheck,
websiteCheck,
downloadCheck,
downloadSkylinkCheck,
downloadResolverSkylinkCheck,
skylinkSubdomainCheck,
handshakeSubdomainCheck,
registryWriteAndReadCheck,
Expand Down

0 comments on commit d1fbb48

Please sign in to comment.