Skip to content

Commit

Permalink
Merge pull request #37 from ufosc/feature/refactor-services-buildout
Browse files Browse the repository at this point in the history
fix issue with swagger in network mode
  • Loading branch information
IkeHunter authored Sep 5, 2024
2 parents bab030d + 72aae00 commit 8550ed2
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 5 deletions.
3 changes: 2 additions & 1 deletion docker-compose.network.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions packages/lib/kafka.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions server/config/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
3 changes: 2 additions & 1 deletion server/docs/swagger.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { BASE_URL } from 'server/config'
import { ResponseCodes, formatJsonResponse } from 'server/utils'
import swaggerAutogen from 'swagger-autogen'

Expand All @@ -12,7 +13,7 @@ const doc = {
title: 'Jukebox API',
description: 'Documentation automatically generated by the <b>swagger-autogen</b> module.'
},
host: 'localhost:' + process.env.PORT,
host: BASE_URL.replace(/(http|https):\/\//, ''),
basePath: '/',
schemes: ['http', 'https'],
consumes: ['application/json'],
Expand Down
2 changes: 1 addition & 1 deletion server/docs/swagger_output.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"title": "Jukebox API",
"description": "Documentation automatically generated by the <b>swagger-autogen</b> module."
},
"host": "localhost:9000",
"host": "localhost:8080",
"basePath": "/",
"tags": [
{
Expand Down

0 comments on commit 8550ed2

Please sign in to comment.