Skip to content

Commit

Permalink
feat(api): Reading port Dynamically (#170)
Browse files Browse the repository at this point in the history
  • Loading branch information
Animesh7853 committed Mar 21, 2024
1 parent eddbce8 commit fd46e3e
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ GITHUB_CLIENT_ID=
GITHUB_CLIENT_SECRET=
GITHUB_CALLBACK_URL=

API_PORT=

GOOGLE_CLIENT_ID=
GOOGLE_CLIENT_SECRET=
GOOGLE_CALLBACK_URL=
Expand Down
2 changes: 1 addition & 1 deletion apps/api/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ RUN pnpm db:generate-types
RUN pnpm build:api
RUN pnpm sourcemaps:api

EXPOSE 4200
EXPOSE ${API_PORT:-4200}

ENTRYPOINT ["node", "apps/api/dist/main.js"]
2 changes: 1 addition & 1 deletion apps/api/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ async function initializeNestApp() {
}),
new QueryTransformPipe()
)
const port = 4200
const port = process.env.API_PORT || 4200
const swaggerConfig = new DocumentBuilder()
.setTitle('keyshade')
.setDescription('The keyshade API description')
Expand Down
1 change: 1 addition & 0 deletions docs/contributing-to-keyshade/environment-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ Here's the description of the environment variables used in the project. You can
* **FROM\_EMAIL**: The display of the email sender title.
* **JWT\_SECRET**: The secret used to sign the JWT tokens. It is insignificant in the development environment.
* **WEB\_FRONTEND\_URL, WORKSPACE\_FRONTEND\_URL**: The URLs of the web and workspace frontend respectively. These are used in the emails sometimes and in other spaces of the application too.
* **API\_PORT**: The environmental variable that specifies the port number on which the API server should listen for incoming connections. If not explicitly set, it defaults to port 4200.

0 comments on commit fd46e3e

Please sign in to comment.