-
Notifications
You must be signed in to change notification settings - Fork 141
fix(dev): make just recipes WSL2-friendly #858
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -29,13 +29,19 @@ dev: | |||||||||||||||||||||||||||||||||||||||||||||||||
| bun run concurrently --kill-others --names srv,bbb,web --prefix-colors auto \ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| "just relay" \ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| "sleep 1 && just pub bbb http://localhost:4443/anon" \ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| "sleep 2 && just web http://localhost:4443/anon" | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| "sleep 2 && just web auto" | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| # Run a localhost relay server without authentication. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| relay *args: | ||||||||||||||||||||||||||||||||||||||||||||||||||
| # Run the relay server overriding the provided configuration file. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| TOKIO_CONSOLE_BIND=127.0.0.1:6680 cargo run --bin moq-relay -- dev/relay.toml {{args}} | ||||||||||||||||||||||||||||||||||||||||||||||||||
| @if [ -n "${WSL_DISTRO_NAME:-}" ]; then \ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| ip="$(hostname -I | awk '{print $1}')"; \ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| TOKIO_CONSOLE_BIND=127.0.0.1:6680 cargo run --bin moq-relay -- dev/relay.toml \ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| --server-bind "0.0.0.0:4443" \ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| --tls-generate "localhost,$ip" \ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| {{args}}; \ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| else \ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| TOKIO_CONSOLE_BIND=127.0.0.1:6680 cargo run --bin moq-relay -- dev/relay.toml {{args}}; \ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| # Run a cluster of relay servers | ||||||||||||||||||||||||||||||||||||||||||||||||||
| cluster: | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -260,8 +266,17 @@ serve name *args: | |||||||||||||||||||||||||||||||||||||||||||||||||
| --name "{{name}}" fmp4 | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| # Run the web server | ||||||||||||||||||||||||||||||||||||||||||||||||||
| web url='http://localhost:4443/anon': | ||||||||||||||||||||||||||||||||||||||||||||||||||
| cd js/hang-demo && VITE_RELAY_URL="{{url}}" bun run dev | ||||||||||||||||||||||||||||||||||||||||||||||||||
| web url="auto": | ||||||||||||||||||||||||||||||||||||||||||||||||||
| @url="{{url}}"; \ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| if [ "$url" = "auto" ]; then \ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| if [ -n "${WSL_DISTRO_NAME:-}" ]; then \ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| ip="$(hostname -I | awk '{print $1}')"; \ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| url="http://$ip:4443/anon"; \ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| else \ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| url="http://localhost:4443/anon"; \ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| fi; \ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| fi; \ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| cd js/hang-demo && VITE_RELAY_URL="$url" bun run dev -- --host 0.0.0.0 | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+269
to
+279
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Avoid binding Vite to all interfaces outside WSL.
🔒 Suggested conditional host binding web url="auto":
`@url`="{{url}}"; \
+ host="127.0.0.1"; \
if [ "$url" = "auto" ]; then \
if [ -n "${WSL_DISTRO_NAME:-}" ]; then \
ip="$(hostname -I | awk '{print $1}')"; \
url="http://$ip:4443/anon"; \
+ host="0.0.0.0"; \
else \
url="http://localhost:4443/anon"; \
fi; \
fi; \
- cd js/hang-demo && VITE_RELAY_URL="$url" bun run dev -- --host 0.0.0.0
+ cd js/hang-demo && VITE_RELAY_URL="$url" bun run dev -- --host "$host"📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| # Publish the clock broadcast | ||||||||||||||||||||||||||||||||||||||||||||||||||
| # `action` is either `publish` or `subscribe` | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
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.
Add a guard for empty WSL IP detection.
If
hostname -Ireturns nothing, TLS SAN becomes invalid and the relay may fail or generate a bad cert. Consider a fast-fail check.🛠️ Suggested guard
📝 Committable suggestion
🤖 Prompt for AI Agents