Vite devserver configuration that behaves correctly for auth-host, serving the profile view at site root and /admin/ instead of under /auth/.
This commit is contained in:
@@ -118,7 +118,7 @@ def parse_endpoint(
|
||||
return host, port, None, False
|
||||
|
||||
|
||||
def run_vite(vite_url: str, vite_host: str | None, vite_port: int):
|
||||
def run_vite(vite_url: str, vite_host: str | None, vite_port: int, auth_host: str | None = None):
|
||||
"""Spawn the frontend dev server (deno, npm, or bunx) as a background process."""
|
||||
devpath = Path(__file__).parent.parent / "frontend"
|
||||
if not (devpath / "package.json").exists():
|
||||
@@ -160,7 +160,10 @@ def run_vite(vite_url: str, vite_host: str | None, vite_port: int):
|
||||
|
||||
full_cmd = cmd + vite_args
|
||||
stderr.write(f">>> {' '.join([tool_name, *full_cmd[1:]])}\n")
|
||||
vite_process = subprocess.Popen(full_cmd, cwd=str(devpath), shell=False)
|
||||
vite_env = os.environ.copy()
|
||||
if auth_host:
|
||||
vite_env["PASKIA_AUTH_HOST"] = auth_host
|
||||
vite_process = subprocess.Popen(full_cmd, cwd=str(devpath), shell=False, env=vite_env)
|
||||
except Exception as e:
|
||||
stderr.write(
|
||||
f"┃ ⚠️ Vite couldn't start: {e}\n"
|
||||
@@ -418,7 +421,7 @@ def main():
|
||||
raise SystemExit(1)
|
||||
|
||||
# Start Vite dev server
|
||||
run_vite(vite_url, vite_host, vite_port)
|
||||
run_vite(vite_url, vite_host, vite_port, args.auth_host)
|
||||
|
||||
# Set dev mode with Vite URL in environment for subprocess
|
||||
env = os.environ.copy()
|
||||
|
||||
Reference in New Issue
Block a user