Browse Source

Fix alert endpoint env name

pull/1/head
rozetko 6 years ago
parent
commit
90b501858d
  1. 9
      server/src/services/notification.ts

9
server/src/services/notification.ts

@ -15,15 +15,16 @@ function sendNotification(anomalyId, active) {
notification.status = 'OK'; notification.status = 'OK';
} }
if(process.env.ALERT_ENDPOINT !== undefined) { let endpoint = process.env.HASTIC_ALERT_ENDPOINT;
fetch(process.env.ALERT_ENDPOINT, { if(endpoint !== undefined) {
fetch(endpoint, {
method: 'POST', method: 'POST',
body: JSON.stringify(notification) body: JSON.stringify(notification)
}) })
.then(data => console.log(data)) .then(data => console.log(data))
.catch(err => console.error(`Can't send alert to ${process.env.ALERT_ENDPOINT}. Error: ${err}`)); .catch(err => console.error(`Can't send alert to ${endpoint}. Error: ${err}`));
} else { } else {
console.error(`Can't send alert, env ALERT_ENDPOINT is undefined`); console.error(`Can't send alert, env HASTIC_ALERT_ENDPOINT is undefined`);
} }
} }

Loading…
Cancel
Save