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_ # default: _CHAT_ID_
# noc: _CHAT_ID_ # noc: _CHAT_ID_
# - file: reportPullAPI
# channels:
# - hijack
# - newprefix
# - visibility
# - path
# - misconfiguration
# - rpki
# params:
# maxAlertsAmount: 10
############################ ############################
# Notification settings: # Notification settings:
@@ -241,8 +251,16 @@ reports:
notificationIntervalSeconds: 86400 notificationIntervalSeconds: 86400
persistStatus: true 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: rest:
host: null host: localhost
port: 8011 port: 8011
logging: logging:
@@ -264,8 +282,6 @@ generatePrefixListEveryDays: 0
# - file: uptimeApi # - file: uptimeApi
# params: # params:
# useStatusCodes: true # useStatusCodes: true
# host: null
# port: 8011
# #
# - file: uptimeHealthcheck # - file: uptimeHealthcheck
# params: # params:

View File

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

View File

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