Skip to content

feat: support better port 0 user facing messages #2859

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

Merged
merged 1 commit into from
Apr 21, 2025
Merged

Conversation

RobWalt
Copy link

@RobWalt RobWalt commented Apr 19, 2025

Supersedes #2848. See that PR for details.

If a user chooses to use port 0, then the operating system will choose
one of the available ports automatically. This is very useful in cases
where you want to allow a `zola serve` for a broader user base which
might already bind a subset of their ports and if you don't know which
ones they might use.

This feature was already supported by zola, however, the printed output
just printed port 0 and didn't report which port the operating system
actually chose.

Example output of `zola serve -p 0` before the change

```
Web server is available at http://127.0.0.1:0 (bound to 127.0.0.1:0)
```

Example output of `zola serve -p 0` after the change

```
Web server is available at http://127.0.0.1:37327 (bound to 127.0.0.1:37327)
```
Copy link
Collaborator

@Keats Keats left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@Keats Keats merged commit a4e4167 into getzola:next Apr 21, 2025
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