mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-12-23 21:57:45 -06:00
fix: adjusts in dockerfile
This commit is contained in:
@@ -3,7 +3,7 @@ import { load } from 'js-yaml';
|
||||
import { join } from 'path';
|
||||
import { isBooleanString } from 'class-validator';
|
||||
|
||||
export type HttpServer = { TYPE: 'http' | 'https'; PORT: number };
|
||||
export type HttpServer = { TYPE: 'http' | 'https'; PORT: number; URL: string };
|
||||
|
||||
export type HttpMethods = 'POST' | 'GET' | 'PUT' | 'DELETE';
|
||||
export type Cors = {
|
||||
@@ -173,6 +173,7 @@ export class ConfigService {
|
||||
SERVER: {
|
||||
TYPE: process.env.SERVER_TYPE as 'http' | 'https',
|
||||
PORT: Number.parseInt(process.env.SERVER_PORT),
|
||||
URL: process.env.SERVER_URL,
|
||||
},
|
||||
CORS: {
|
||||
ORIGIN: process.env.CORS_ORIGIN.split(','),
|
||||
|
||||
@@ -28,21 +28,18 @@ export class InstanceController {
|
||||
|
||||
private readonly logger = new Logger(InstanceController.name);
|
||||
|
||||
public async createInstance(
|
||||
{
|
||||
instanceName,
|
||||
webhook,
|
||||
webhook_by_events,
|
||||
events,
|
||||
qrcode,
|
||||
token,
|
||||
chatwoot_account_id,
|
||||
chatwoot_token,
|
||||
chatwoot_url,
|
||||
chatwoot_sign_msg,
|
||||
}: InstanceDto,
|
||||
apiURL: string,
|
||||
) {
|
||||
public async createInstance({
|
||||
instanceName,
|
||||
webhook,
|
||||
webhook_by_events,
|
||||
events,
|
||||
qrcode,
|
||||
token,
|
||||
chatwoot_account_id,
|
||||
chatwoot_token,
|
||||
chatwoot_url,
|
||||
chatwoot_sign_msg,
|
||||
}: InstanceDto) {
|
||||
this.logger.verbose('requested createInstance from ' + instanceName + ' instance');
|
||||
|
||||
const mode = this.configService.get<Auth>('AUTHENTICATION').INSTANCE.MODE;
|
||||
@@ -143,7 +140,7 @@ export class InstanceController {
|
||||
throw new BadRequestException('Invalid "url" property in chatwoot');
|
||||
}
|
||||
|
||||
const urlServer = apiURL;
|
||||
const urlServer = this.configService.get<HttpServer>('SERVER').URL;
|
||||
|
||||
try {
|
||||
this.chatwootService.create(instance, {
|
||||
@@ -285,7 +282,7 @@ export class InstanceController {
|
||||
throw new BadRequestException('Invalid "url" property in chatwoot');
|
||||
}
|
||||
|
||||
const urlServer = apiURL;
|
||||
const urlServer = this.configService.get<HttpServer>('SERVER').URL;
|
||||
|
||||
try {
|
||||
this.chatwootService.create(instance, {
|
||||
|
||||
@@ -24,14 +24,11 @@ export class InstanceRouter extends RouterBroker {
|
||||
logger.verbose('request query: ');
|
||||
logger.verbose(req.query);
|
||||
|
||||
const apiURL = req.headers.host || req.hostname;
|
||||
logger.verbose('API URL: ' + apiURL);
|
||||
|
||||
const response = await this.dataValidate<InstanceDto>({
|
||||
request: req,
|
||||
schema: instanceNameSchema,
|
||||
ClassRef: InstanceDto,
|
||||
execute: (instance) => instanceController.createInstance(instance, apiURL),
|
||||
execute: (instance) => instanceController.createInstance(instance),
|
||||
});
|
||||
|
||||
return res.status(HttpStatus.CREATED).json(response);
|
||||
|
||||
Reference in New Issue
Block a user