Skip to content

Commit

Permalink
Update HealthChecks.io API address
Browse files Browse the repository at this point in the history
  • Loading branch information
tombeynon committed Nov 4, 2024
1 parent 3c00273 commit a27a227
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/autostake/Health.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class Health {
const { address, uuid, name, apiKey, timeout, gracePeriod } = config || {}
const { dryRun, networkName } = opts || {}
this.address = address || 'https://hc-ping.com'
this.apiAddress = apiAddress || 'https://healthchecks.io'
this.name = name || networkName
this.gracePeriod = gracePeriod || 86400 // default 24 hours
this.timeout = timeout || 86400 // default 24 hours
Expand All @@ -18,7 +19,7 @@ class Health {

if (address) {
// This is necessary as the default provider - hc-ping.com - has a built in ping mechanism
// whereas providing self-hosted addresses do NOT.
// whereas providing self-hosted addresses do NOT.
// https://healthchecks.selfhosted.com/ping/{uuid} rather than https://hc-ping.com/{uuid}
this.address = this.address + "/ping"
}
Expand Down Expand Up @@ -65,7 +66,7 @@ class Health {
}

try {
await axios.post([this.address, 'api/v2/checks/'].join('/'), data, config).then((res) => {
await axios.post([this.apiAddress, 'api/v2/checks/'].join('/'), data, config).then((res) => {
this.uuid = res.data.ping_url.split('/')[4]
});
} catch (error) {
Expand All @@ -92,4 +93,4 @@ class Health {
}
}

export default Health
export default Health

0 comments on commit a27a227

Please sign in to comment.