style: tidy gateway auth imports

This commit is contained in:
Peter Steinberger
2026-01-08 08:24:39 +01:00
parent a676e16fbb
commit c7cade5232
3 changed files with 8 additions and 5 deletions

View File

@@ -3,6 +3,7 @@ import fs from "node:fs";
import type { Command } from "commander"; import type { Command } from "commander";
import { import {
CONFIG_PATH_CLAWDBOT, CONFIG_PATH_CLAWDBOT,
type GatewayAuthMode,
loadConfig, loadConfig,
readConfigFileSnapshot, readConfigFileSnapshot,
resolveGatewayPort, resolveGatewayPort,
@@ -13,8 +14,8 @@ import {
GATEWAY_WINDOWS_TASK_NAME, GATEWAY_WINDOWS_TASK_NAME,
} from "../daemon/constants.js"; } from "../daemon/constants.js";
import { resolveGatewayService } from "../daemon/service.js"; import { resolveGatewayService } from "../daemon/service.js";
import { callGateway } from "../gateway/call.js";
import { resolveGatewayAuth } from "../gateway/auth.js"; import { resolveGatewayAuth } from "../gateway/auth.js";
import { callGateway } from "../gateway/call.js";
import { startGatewayServer } from "../gateway/server.js"; import { startGatewayServer } from "../gateway/server.js";
import { import {
type GatewayWsLogStyle, type GatewayWsLogStyle,
@@ -358,7 +359,7 @@ export function registerGatewayCli(program: Command) {
process.env.CLAWDBOT_GATEWAY_TOKEN = String(opts.token); process.env.CLAWDBOT_GATEWAY_TOKEN = String(opts.token);
} }
const authModeRaw = opts.auth ? String(opts.auth) : undefined; const authModeRaw = opts.auth ? String(opts.auth) : undefined;
const authMode = const authMode: GatewayAuthMode | null =
authModeRaw === "token" || authModeRaw === "password" authModeRaw === "token" || authModeRaw === "password"
? authModeRaw ? authModeRaw
: null; : null;
@@ -584,5 +585,4 @@ export function registerGatewayCli(program: Command) {
} }
}), }),
); );
} }

View File

@@ -1,6 +1,9 @@
import { timingSafeEqual } from "node:crypto"; import { timingSafeEqual } from "node:crypto";
import type { IncomingMessage } from "node:http"; import type { IncomingMessage } from "node:http";
import type { GatewayAuthConfig, GatewayTailscaleMode } from "../config/config.js"; import type {
GatewayAuthConfig,
GatewayTailscaleMode,
} from "../config/config.js";
export type ResolvedGatewayAuthMode = "none" | "token" | "password"; export type ResolvedGatewayAuthMode = "none" | "token" | "password";
export type ResolvedGatewayAuth = { export type ResolvedGatewayAuth = {

View File

@@ -102,8 +102,8 @@ import type { WizardSession } from "../wizard/session.js";
import { import {
assertGatewayAuthConfigured, assertGatewayAuthConfigured,
authorizeGatewayConnect, authorizeGatewayConnect,
resolveGatewayAuth,
type ResolvedGatewayAuth, type ResolvedGatewayAuth,
resolveGatewayAuth,
} from "./auth.js"; } from "./auth.js";
import { import {
type GatewayReloadPlan, type GatewayReloadPlan,