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

fixed default config

This commit is contained in:
Massimo Candela
2021-05-21 18:50:03 +02:00
parent d063a4ebd4
commit e966d59052
3 changed files with 24 additions and 9 deletions

View File

@@ -228,6 +228,16 @@ reports:
# default: _CHAT_ID_
# noc: _CHAT_ID_
# - file: reportPullAPI
# channels:
# - hijack
# - newprefix
# - visibility
# - path
# - misconfiguration
# - rpki
# params:
# maxAlertsAmount: 10
############################
# Notification settings:
@@ -241,8 +251,16 @@ reports:
notificationIntervalSeconds: 86400
persistStatus: true
############################
# REST API settings:
# - rest.host
# The IP address the server will listen. By default is localhost
# - rest.port
# The port the server will listen
rest:
host: null
host: localhost
port: 8011
logging:
@@ -264,8 +282,6 @@ generatePrefixListEveryDays: 0
# - file: uptimeApi
# params:
# useStatusCodes: true
# host: null
# port: 8011
#
# - file: uptimeHealthcheck
# params:

View File

@@ -112,7 +112,7 @@ export default class Config {
refreshVrpListMinutes: 15
},
rest: {
host: null,
host: "localhost",
port: 8011
},
checkForUpdatesAtBoot: true,

View File

@@ -33,7 +33,6 @@
import Report from "./report";
import RestApi from "../utils/restApi";
import md5 from "md5";
import moment from "moment";
export default class ReportPullAPI extends Report {
@@ -42,8 +41,8 @@ export default class ReportPullAPI extends Report {
this.name = "reportPullAPI" || this.params.name;
this.enabled = true;
this.maxAlertsAmount = 100;
this.lastCheck = null;
this.maxAlertsAmount = this.params.maxAlertsAmount || 100;
this.lastQuery = null;
let restDefault = env.config.rest || { port: params.port, host: params.host };
const rest = new RestApi(restDefault);
@@ -79,12 +78,12 @@ export default class ReportPullAPI extends Report {
res.contentType = 'json';
res.send({
meta: {
lastCheck: this.lastCheck
lastQuery: this.lastQuery
},
data: this._getAlerts(req.params)
});
next();
this.lastCheck = moment(new Date()).utc();
this.lastQuery = new Date().getTime();
};
_getAlerts = ({ hash, group }) => {