From 90b501858dceaee15180cd3666b77911e101f2f8 Mon Sep 17 00:00:00 2001 From: rozetko Date: Fri, 25 May 2018 19:24:14 +0300 Subject: [PATCH] Fix alert endpoint env name --- server/src/services/notification.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/server/src/services/notification.ts b/server/src/services/notification.ts index 7af62b4..1975af0 100644 --- a/server/src/services/notification.ts +++ b/server/src/services/notification.ts @@ -15,15 +15,16 @@ function sendNotification(anomalyId, active) { notification.status = 'OK'; } - if(process.env.ALERT_ENDPOINT !== undefined) { - fetch(process.env.ALERT_ENDPOINT, { + let endpoint = process.env.HASTIC_ALERT_ENDPOINT; + if(endpoint !== undefined) { + fetch(endpoint, { method: 'POST', body: JSON.stringify(notification) }) .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 { - console.error(`Can't send alert, env ALERT_ENDPOINT is undefined`); + console.error(`Can't send alert, env HASTIC_ALERT_ENDPOINT is undefined`); } }