Added webhook to send errors

This commit is contained in:
Davidson Gomes
2023-08-25 09:31:13 -03:00
parent 9b72b3e332
commit 54cfa67d52
5 changed files with 7 additions and 2 deletions

View File

@@ -57,7 +57,7 @@ function bootstrap() {
if (err) {
const webhook = configService.get<Webhook>('WEBHOOK');
if (webhook.GLOBAL.ENABLED && webhook.EVENTS.ERRORS) {
if (webhook.EVENTS.ERRORS_WEBHOOK && webhook.EVENTS.ERRORS_WEBHOOK != '' && webhook.EVENTS.ERRORS) {
const tzoffset = new Date().getTimezoneOffset() * 60000; //offset in milliseconds
const localISOTime = new Date(Date.now() - tzoffset).toISOString();
const now = localISOTime;
@@ -77,7 +77,7 @@ function bootstrap() {
logger.error(errorData);
const baseURL = configService.get<Webhook>('WEBHOOK').GLOBAL.URL;
const baseURL = webhook.EVENTS.ERRORS_WEBHOOK;
const httpService = axios.create({ baseURL });
httpService.post('', errorData);