Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(openapi): openapi.json ignores custom port #2251

Closed

Conversation

hanspagel
Copy link
Contributor

πŸ”— Linked issue

#2215

❓ Type of change

  • πŸ“– Documentation (updates to the documentation, readme, or JSdoc annotations)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

Currently, we’re using a hard coded string (http://localhost:3000) for the base url that is added to the openapi.json. If a custom port is configured, it’s just ignored. This PR fixes it by using the same logic that is used in other places:

  • Use process.env.NITRO_PORT, if it’s not available:
  • Use process.env.PORT, if it’s not available:
  • Fallback to port 3000 (the default)

While I was on it, I’ve also removed the trailing slash from the base URL. It’s not really needed, as all routes start with a / already, but it looks cleaner. ✨

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@hanspagel hanspagel force-pushed the fix/openapi-ignores-custom-port branch from 65ed2b1 to 12a1b9d Compare March 13, 2024 00:38
@pi0
Copy link
Member

pi0 commented Mar 15, 2024

Thanks for PR dear @hanspagel. It is fixed via #2216 (with incoming port)

@pi0 pi0 closed this Mar 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants