Enhance run-aspire.cmd to support Tailscale integration for remote access. The script now checks for Tailscale availability and connection status, providing warnings if not found or connected. Updated documentation in AGENTS.md and README.md to reflect changes, including instructions for using Tailscale with the Vite client. Fixed Vite configuration to pin the client port to 5173 and support HMR over Tailscale. Adjusted AppHost.cs to ensure proper endpoint targeting for Tailscale.
This commit is contained in:
@@ -23,7 +23,9 @@ if (headless)
|
||||
|
||||
if (!headless)
|
||||
{
|
||||
// Pin the Vite port so `tailscale serve --bg 5173` always targets the client.
|
||||
var client = builder.AddViteApp("client", "../HSchool.Client")
|
||||
.WithHttpEndpoint(port: 5173, targetPort: 5173)
|
||||
.WithReference(server)
|
||||
.WaitFor(server);
|
||||
|
||||
|
||||
@@ -4,8 +4,16 @@ import { defineConfig } from 'vitest/config';
|
||||
// so the dev server proxies to whatever port the backend actually got.
|
||||
const backend = process.env.SERVER_HTTPS ?? process.env.SERVER_HTTP ?? 'http://localhost:5180';
|
||||
|
||||
// Set HSCHOOL_TAILSCALE_SERVE=1 when exposing Vite through `tailscale serve` so HMR
|
||||
// uses wss:443 instead of the dev-server port. Gameplay does not need this.
|
||||
const tailscaleServe = process.env.HSCHOOL_TAILSCALE_SERVE === '1';
|
||||
|
||||
export default defineConfig({
|
||||
server: {
|
||||
port: 5173,
|
||||
strictPort: true,
|
||||
allowedHosts: ['.ts.net'],
|
||||
hmr: tailscaleServe ? { protocol: 'wss', clientPort: 443 } : undefined,
|
||||
proxy: {
|
||||
'/api': {
|
||||
target: backend,
|
||||
|
||||
Reference in New Issue
Block a user