Skip to content

Commit

Permalink
🐛 Fix TypeScript syntax, update IP condition
Browse files Browse the repository at this point in the history
  • Loading branch information
AnandChowdhary authored Dec 10, 2023
1 parent fcebd9e commit 7685333
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,19 +156,18 @@ export const update = async (shouldCommit = false) => {
try {
let status: "up" | "down" | "degraded" = "up";
// https://github.com/upptime/upptime/discussions/888
const url = replaceEnvironmentVariables(site.url),
let address;
if (isIP(url)) {
const url = replaceEnvironmentVariables(site.url);
let address = url;
if (isIP(url) {

Check failure on line 161 in src/update.ts

View workflow job for this annotation

GitHub Actions / Build and Publish

')' expected.
if (site.ipv6 && !isIPv6(url))
throw Error('Site URL must be IPv6 for ipv6 check');
address = url;
} else {
if (site.ipv6)
throw new Error("Site URL must be IPv6 for ipv6 check");
else if (site.ipv6)
address = (await dns.promises.resolve6(url))[0];
else
address = (await dns.promises.resolve4(url))[0];
if (!isIP(address))
throw Error('Site IP address could not be resolved');

if (isIP(url) && !isIP(address))
throw new Error("Site IP address could not be resolved");
}

const tcpResult = await ping({
Expand Down

0 comments on commit 7685333

Please sign in to comment.