fix(doctor,configure): skip gateway auth for loopback-only setups

This commit is contained in:
Knox
2026-02-16 22:21:02 +05:30
committed by Peter Steinberger
parent 6757a9fedc
commit 9aa8db5c81
3 changed files with 71 additions and 53 deletions

View File

@@ -123,14 +123,18 @@ export async function doctorCommand(
note(gatewayDetails.remoteFallbackNote, "Gateway");
}
if (resolveMode(cfg) === "local") {
const gatewayBind = cfg.gateway?.bind ?? "loopback";
const tailscaleMode = cfg.gateway?.tailscale?.mode ?? "off";
const requireGatewayAuth = gatewayBind !== "loopback" || tailscaleMode !== "off";
const auth = resolveGatewayAuth({
authConfig: cfg.gateway?.auth,
tailscaleMode: cfg.gateway?.tailscale?.mode ?? "off",
tailscaleMode,
});
const needsToken = auth.mode !== "password" && (auth.mode !== "token" || !auth.token);
const needsToken =
requireGatewayAuth && auth.mode !== "password" && (auth.mode !== "token" || !auth.token);
if (needsToken) {
note(
"Gateway auth is off or missing a token. Token auth is now the recommended default (including loopback).",
"Gateway auth is off or missing a token. Token auth is recommended when the gateway is exposed beyond local loopback.",
"Gateway auth",
);
const shouldSetToken =