diff --git a/docker-compose.network.yml b/docker-compose.network.yml index 4ac1013..ba43609 100644 --- a/docker-compose.network.yml +++ b/docker-compose.network.yml @@ -11,11 +11,12 @@ services: - HOST=localhost - JWT_SECRET_KEY=changeme - TOKEN_HEADER_KEY=Authorization - - MONGO_URI=mongodb://root:changeme@mmongo-network-jbx:27017 + - MONGO_URI=mongodb://root:changeme@mongo-network-jbx:27017 - SP_ID=${SP_ID} - SP_SECRET=${SP_SECRET} - LOG_LEVEL=debug - KAFKA_BROKERS=kafka-jbx:9092 + - BASE_URL=http://localhost:8080 ports: - 9000:9000 depends_on: diff --git a/packages/lib/kafka.ts b/packages/lib/kafka.ts index 11cb86d..4ea7c8c 100644 --- a/packages/lib/kafka.ts +++ b/packages/lib/kafka.ts @@ -50,8 +50,8 @@ const getKafkaInstance = () => { brokers: KAFKA_BROKERS, logLevel: logLevel.INFO, logCreator: WinstonLogCreator, - connectionTimeout: 10000, - requestTimeout: 10000, + connectionTimeout: 20000, + requestTimeout: 20000, retry: { retries: 5, diff --git a/server/config/constants.ts b/server/config/constants.ts index 6d4af06..700433f 100644 --- a/server/config/constants.ts +++ b/server/config/constants.ts @@ -6,6 +6,7 @@ type nodenv = 'development' | 'production' | 'test' | 'network' export const HOST: string = process.env.HOST || 'localhost' export const PORT = process.env.PORT || 3000 export const MONGO_URI = process.env.MONGO_URI || 'mongodb://localhost:27017/mongo-jukebox' +export const BASE_URL = process.env.BASE_URL || `http://${HOST}:${PORT}` export const JWT_SECRET_KEY: string = process.env.JWT_SECRET_KEY || 'secret' export const JWT_ISSUER = process.env.JWT_ISSUER || 'jukebox' diff --git a/server/docs/swagger.ts b/server/docs/swagger.ts index e7fea41..e4dfeb4 100644 --- a/server/docs/swagger.ts +++ b/server/docs/swagger.ts @@ -1,3 +1,4 @@ +import { BASE_URL } from 'server/config' import { ResponseCodes, formatJsonResponse } from 'server/utils' import swaggerAutogen from 'swagger-autogen' @@ -12,7 +13,7 @@ const doc = { title: 'Jukebox API', description: 'Documentation automatically generated by the swagger-autogen module.' }, - host: 'localhost:' + process.env.PORT, + host: BASE_URL.replace(/(http|https):\/\//, ''), basePath: '/', schemes: ['http', 'https'], consumes: ['application/json'], diff --git a/server/docs/swagger_output.json b/server/docs/swagger_output.json index 7c6b274..47ffd9e 100644 --- a/server/docs/swagger_output.json +++ b/server/docs/swagger_output.json @@ -5,7 +5,7 @@ "title": "Jukebox API", "description": "Documentation automatically generated by the swagger-autogen module." }, - "host": "localhost:9000", + "host": "localhost:8080", "basePath": "/", "tags": [ {