Skip to content

Commit

Permalink
fix the ReferenceError: resolved_color is not defined error (#16)
Browse files Browse the repository at this point in the history
* fix the 'ReferenceError: resolved_color is not defined' error

* hardcode resolved_color to stablize container

* remove debug lines
  • Loading branch information
jessebot authored Jul 17, 2024
1 parent 3013c36 commit 0942425
Show file tree
Hide file tree
Showing 3 changed files with 108 additions and 63 deletions.
158 changes: 100 additions & 58 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "matrix-alertmanager",
"version": "0.12.0",
"version": "0.12.1",
"description": "Prometheus Alertmanager bot for Matrix",
"main": "src/app.js",
"scripts": {
Expand Down
11 changes: 7 additions & 4 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,15 @@ const utils = {
}
})(data.labels.severity);
parts.push('<summary><font color=\"' + color + '\"><b>FIRING</b>: ' + summary + env + '</font></summary>')

} else if (data.status === 'resolved') {

// determine best logging color for resolved alerts
let resolved_color = "#a8fd57";
if (process.env.COLOR_RECOVERED) {
let resolved_color = process.env.COLOR_RECOVERED
} else {
let resolved_color = "#a8fd57"
}
let resolved_color = process.env.COLOR_RECOVERED;
};

parts.push('<summary><font color=\"' + resolved_color + '\"><b>RESOLVED</b>: ' + summary + env + '</font></summary>')
} else {
parts.push('<summary>' + data.status.toUpperCase() + ': ' + summary + env + '</summary>')
Expand Down

0 comments on commit 0942425

Please sign in to comment.