mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-12-18 19:32:21 -06:00
Added support for messaging with ads on chatwoot
This commit is contained in:
11
src/main.ts
11
src/main.ts
@@ -6,7 +6,7 @@ import cors from 'cors';
|
||||
import express, { json, NextFunction, Request, Response, urlencoded } from 'express';
|
||||
import { join } from 'path';
|
||||
|
||||
import { configService, Cors, HttpServer, Rabbitmq, Webhook } from './config/env.config';
|
||||
import { Auth, configService, Cors, HttpServer, Rabbitmq, Webhook } from './config/env.config';
|
||||
import { onUnexpectedError } from './config/error.config';
|
||||
import { Logger } from './config/logger.config';
|
||||
import { ROOT_DIR } from './config/path.config';
|
||||
@@ -61,6 +61,8 @@ function bootstrap() {
|
||||
const tzoffset = new Date().getTimezoneOffset() * 60000; //offset in milliseconds
|
||||
const localISOTime = new Date(Date.now() - tzoffset).toISOString();
|
||||
const now = localISOTime;
|
||||
const globalApiKey = configService.get<Auth>('AUTHENTICATION').API_KEY.KEY;
|
||||
const serverUrl = configService.get<HttpServer>('SERVER').URL;
|
||||
|
||||
const errorData = {
|
||||
event: 'error',
|
||||
@@ -73,6 +75,8 @@ function bootstrap() {
|
||||
},
|
||||
},
|
||||
date_time: now,
|
||||
api_key: globalApiKey,
|
||||
server_url: serverUrl,
|
||||
};
|
||||
|
||||
logger.error(errorData);
|
||||
@@ -83,11 +87,6 @@ function bootstrap() {
|
||||
httpService.post('', errorData);
|
||||
}
|
||||
|
||||
if (err['message'].includes('No sessions')) {
|
||||
console.log(err['message']);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
return res.status(err['status'] || 500).json({
|
||||
status: err['status'] || 500,
|
||||
error: err['error'] || 'Internal Server Error',
|
||||
|
||||
Reference in New Issue
Block a user