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

Enable watch server from arbitrary host #924

Open
tymokvo opened this issue Jun 25, 2024 · 4 comments
Open

Enable watch server from arbitrary host #924

tymokvo opened this issue Jun 25, 2024 · 4 comments

Comments

@tymokvo
Copy link

tymokvo commented Jun 25, 2024

While working on a project with a new developer in a GitHub Codespace today, I wanted to be able to serve the documentation of our feature branch. However, I ran into a limitation of the watch command where dotnet tool run fsdocs watch is incompatible with a remote host because the relative links in the generated HTML are all rooted at http://localhost:8901.

Would it be possible to configure watch to:

  • use an empty string for the {{root}} value in HTML templates
  • serve the /tmp/watch directory
  • redirect requests to paths other than [content | reference]/* to index.html

I think something as simple as dotnet tool run fsdocs watch --remote would be very convenient. Though, maybe there is already a way to accomplish this with a combination of existing flags?

@nojaf
Copy link
Collaborator

nojaf commented Jun 25, 2024

Ah yes, this rings a bell. Maybe adding --parameters root "" will allow for an empty root and makes things relative but I haven't tested this.

@tymokvo
Copy link
Author

tymokvo commented Jun 26, 2024

Hm, that's a start. But it seems that flag works for build but not for watch. All of the static files generated in tmp/watch are still using absolute URLs to localhost:8901.

@tymokvo
Copy link
Author

tymokvo commented Jun 26, 2024

I think I figured out a patch in #925 . But I'm a little suspicious since there was a whole branch dedicated to preventing a user override of root in watch mode.

@nojaf
Copy link
Collaborator

nojaf commented Jul 10, 2024

As mentioned in #925 (comment), I would short term try the --parameters root "/" in watch mode.

Ideal situation would probably be have root be / by default (in future versions) and have a --root flag to easily set this parameter.

I don't know why root has to be localhost for watch mode. I propose to change this and deal with the real problem once it surfaces. We can also play with this during some alphas.

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

No branches or pull requests

2 participants