CLI: harden daemon install refresh helper

This commit is contained in:
Josh Lehman
2026-03-21 11:09:09 -07:00
parent cd968f120c
commit 5228d1937f
2 changed files with 5 additions and 4 deletions

View File

@@ -1,6 +1,6 @@
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import type { DaemonActionResponse } from "./response.js";
import { captureFullEnv } from "../../test-utils/env.js";
import type { DaemonActionResponse } from "./response.js";
const resolveAutoNodeExtraCaCertsMock = vi.hoisted(() => vi.fn());
const loadConfigMock = vi.hoisted(() => vi.fn());

View File

@@ -1,4 +1,3 @@
import type { DaemonInstallOptions } from "./types.js";
import { resolveAutoNodeExtraCaCerts } from "../../bootstrap/node-extra-ca-certs.js";
import { buildGatewayInstallPlan } from "../../commands/daemon-install-helpers.js";
import {
@@ -17,6 +16,7 @@ import {
failIfNixDaemonInstallMode,
parsePort,
} from "./shared.js";
import type { DaemonInstallOptions } from "./types.js";
export async function runDaemonInstall(opts: DaemonInstallOptions) {
const { json, stdout, warnings, emit, fail } = createDaemonInstallActionContext(opts.json);
@@ -141,11 +141,12 @@ async function gatewayServiceNeedsAutoNodeExtraCaCertsRefresh(params: {
if (!currentExecPath) {
return false;
}
const currentNodeExtraCaCerts = currentCommand?.environment?.NODE_EXTRA_CA_CERTS?.trim();
const currentEnvironment = currentCommand?.environment ?? {};
const currentNodeExtraCaCerts = currentEnvironment.NODE_EXTRA_CA_CERTS?.trim();
const expectedNodeExtraCaCerts = resolveAutoNodeExtraCaCerts({
env: {
...params.env,
...currentCommand.environment,
...currentEnvironment,
NODE_EXTRA_CA_CERTS: undefined,
},
execPath: currentExecPath,