-
-
Notifications
You must be signed in to change notification settings - Fork 8.5k
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: allow different host through CLI flag #1475
Conversation
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need the corporate CLA signed. If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks! |
Deploy preview for docusaurus-2 ready! Built with commit b3ff653 |
Deploy preview for docusaurus-preview ready! Built with commit b3ff653 |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR! I don't think the change works for non-Windows users currently. I think we should only change it to 0.0.0.0 when using a container's platform or instead allow the host to be specified as a CLI option if containers aren't tied to a particular platform.
packages/docusaurus-1.x/lib/server/__tests__/liveReloadServer.test.js
Outdated
Show resolved
Hide resolved
@yangshun Great feedback. I can make some changes. |
@endiliey Let me know what you think of this implementation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are some part still using localhost
Example:
@@ -147,6 +147,7 @@ This command will build the static website, apply translations if necessary, and | |||
| Options | Default | Description | | |||
| ----------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------ | | |||
| `--port <number>` | `3000` | The website will be served from port 3000 by default, but if the port is taken up, Docusaurus will attempt to find an available one. | | |||
|`--host <number>`|`localhost`|Use a custom host with localhost as the default.| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is it host ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ha. All good. Ya, I figured number as in 127.0.0.1 but maybe 'value' is better?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Motivation
This would allow folks running Docusaurus in a container to access the site on localhost.
Have you read the Contributing Guidelines on pull requests?
Yes.
Test Plan
From: #920 which appears closed.
yarn start
in the host environment.yarn start
within the container.yarn start
within the container.Note: I have tested this both locally and running inside a Docker container.
Related PRs
#920
Fixes #919
(If this PR adds or changes functionality, please take some time to update the docs at https://github.com/facebook/docusaurus, and link to your PR here.)