Fixed alert features unnecessary URL field #2009

The filling of the URL field was incorrect previously. It has been
updated to handle new monitor types.

Signed-off-by: Matthew Nickson <mnickson@sidingsmedia.com>
This commit is contained in:
Matthew Nickson 2022-10-02 02:26:38 +01:00
parent ceeb47bf82
commit 6a3eccf6a6
No known key found for this signature in database
GPG Key ID: BF229DCFD4748E05

View File

@ -63,7 +63,7 @@ class Teams extends NotificationProvider {
});
}
if (monitorUrl) {
if (monitorUrl && monitorUrl !== "https://") {
facts.push({
name: "URL",
value: monitorUrl,
@ -127,13 +127,17 @@ class Teams extends NotificationProvider {
let url;
if (monitorJSON["type"] === "port") {
url = monitorJSON["hostname"];
if (monitorJSON["port"]) {
url += ":" + monitorJSON["port"];
}
} else {
url = monitorJSON["url"];
switch (monitorJSON["type"]) {
case "http":
case "keywork":
url = monitorJSON["url"];
break;
case "docker":
url = monitorJSON["docker_host"];
break;
default:
url = monitorJSON["hostname"];
break;
}
const payload = this._notificationPayloadFactory({