refactor: redact the gateway address

This commit is contained in:
Kevin Yue 2023-09-01 09:28:44 +08:00
parent 3674a28dee
commit 356946e635

View File

@ -1,6 +1,7 @@
import { atom } from "jotai"; import { atom } from "jotai";
import gatewayService from "../services/gatewayService"; import gatewayService from "../services/gatewayService";
import logger from "../utils/logger"; import logger from "../utils/logger";
import { redact } from "../utils/redact";
import { isProcessingAtom, statusAtom } from "./status"; import { isProcessingAtom, statusAtom } from "./status";
import { connectVpnAtom } from "./vpn"; import { connectVpnAtom } from "./vpn";
@ -20,7 +21,7 @@ export const loginGatewayAtom = atom(
set(statusAtom, "gateway-login"); set(statusAtom, "gateway-login");
let token: string; let token: string;
try { try {
logger.info(`Logging in to gateway ${gateway}...`); logger.info(`Logging in to gateway ${redact(gateway)}...`);
token = await gatewayService.login(gateway, credential); token = await gatewayService.login(gateway, credential);
} catch (err) { } catch (err) {
throw new Error("Failed to login to gateway"); throw new Error("Failed to login to gateway");