fix: improve gateway ssh auth handling
This commit is contained in:
@@ -181,6 +181,10 @@ describe("gateway-status command", () => {
|
||||
|
||||
expect(startSshPortForward).toHaveBeenCalledTimes(1);
|
||||
expect(probeGateway).toHaveBeenCalled();
|
||||
const tunnelCall = probeGateway.mock.calls.find(
|
||||
(call) => typeof call?.[0]?.url === "string" && call[0].url.startsWith("ws://127.0.0.1:"),
|
||||
)?.[0] as { auth?: { token?: string } } | undefined;
|
||||
expect(tunnelCall?.auth?.token).toBe("rtok");
|
||||
expect(sshStop).toHaveBeenCalledTimes(1);
|
||||
|
||||
const parsed = JSON.parse(runtimeLogs.join("\n")) as Record<string, unknown>;
|
||||
|
||||
@@ -134,7 +134,7 @@ export function resolveAuthForTarget(
|
||||
return { token: tokenOverride, password: passwordOverride };
|
||||
}
|
||||
|
||||
if (target.kind === "configRemote") {
|
||||
if (target.kind === "configRemote" || target.kind === "sshTunnel") {
|
||||
const token =
|
||||
typeof cfg.gateway?.remote?.token === "string" ? cfg.gateway.remote.token.trim() : "";
|
||||
const remotePassword = (cfg.gateway?.remote as { password?: unknown } | undefined)?.password;
|
||||
|
||||
Reference in New Issue
Block a user