1
0
mirror of https://github.com/nttgin/BGPalerter.git synced 2024-05-19 06:50:08 +00:00

fixed default template for slack report

This commit is contained in:
Massimo Candela
2021-05-28 21:34:56 +02:00
parent 25584257d8
commit f9e582bca3

View File

@@ -33,9 +33,10 @@
import ReportHTTP from "./reportHTTP";
export default class ReportSlack extends ReportHTTP {
constructor(channels, params, env) {
const templates = {};
const defaultColor = '#4287f5';
const colors = params.colors || {};
const getTemplateItem = (color) => {
return JSON.stringify({
@@ -49,10 +50,10 @@ export default class ReportSlack extends ReportHTTP {
});
};
for (let channel in params.colors) {
templates[channel] = getTemplateItem(params.colors[channel]);
for (let channel in channels) {
templates[channel] = getTemplateItem(colors[channel] || defaultColor);
}
templates["default"] = getTemplateItem('#4287f5');
templates["default"] = getTemplateItem(defaultColor);
const slackParams = {
headers: {},