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

feat: resolved config port #5542

Closed
wants to merge 1 commit into from
Closed

Conversation

HomyeeKing
Copy link
Contributor

Description

can't access port from resolvedConfig

Additional context


What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Before submitting the PR, please make sure you do the following

  • Read the Contributing Guidelines.
  • Read the Pull Request Guidelines and follow the Commit Convention.
  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).
  • Ideally, include relevant tests that fail without this PR but pass with it.

@Shinigami92
Copy link
Member

Could you explain more why you need this?

@HomyeeKing
Copy link
Contributor Author

@Shinigami92 check this issue #5543

@Shinigami92 Shinigami92 linked an issue Nov 5, 2021 that may be closed by this pull request
7 tasks
@HomyeeKing
Copy link
Contributor Author

this pr won't fix the issue #5543 thoroughly, only works for the NO port conflict case
in port conflict case, the problem still exists, we can't get the exact listening port directly

@patak-dev
Copy link
Member

This should be working as expected, but you need to wait until the listening event to access the port info. Check out

serverConfig.port = (httpServer.address() as AddressInfo).port

@HomyeeKing
Copy link
Contributor Author

@patak-js the listening event is triggered later than the configResolved and configureServer hooks invoked, so user can't access the exact port directly unless they listen listening event by hand

@sapphi-red
Copy link
Member

The actual port is not determined until listening event has triggered.
Also configResolved and configureServer hooks triggers before server starts (because it is needed to configure server before server starts).
So it is impossible to know the actual port in those hooks.

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.

can't get exact listened port from configResolved or configureServer
4 participants