mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-29 18:35:26 +00:00
Summary: - This replacement PR marks the Linux node daemon gateway token as file-backed, writes it to `node.systemd.env`, sanitizes and migrates systemd env artifacts, adds regression tests, and updates the changelog. - Reproducibility: yes. from source inspection: current `main` copies `OPENCLAW_GATEWAY_TOKEN` into the node s ... e-backed before systemd rendering. I did not run a local live systemd install during this read-only review. Automerge notes: - PR branch already contained follow-up commit before automerge: fix(systemd): scrub single-quoted env tokens - PR branch already contained follow-up commit before automerge: [Fix] Keep node systemd tokens out of unit files Validation: - ClawSweeper review passed for headf626b66c09. - Required merge gates passed before the squash merge. Prepared head SHA:f626b66c09Review: https://github.com/openclaw/openclaw/pull/84815#issuecomment-4505012292 Co-authored-by: samzong <samzong.lu@gmail.com> Co-authored-by: clawsweeper <274271284+clawsweeper[bot]@users.noreply.github.com> Co-authored-by: clawsweeper[bot] <274271284+clawsweeper[bot]@users.noreply.github.com> Approved-by: takhoffman Co-authored-by: takhoffman <781889+takhoffman@users.noreply.github.com>
87 lines
2.6 KiB
TypeScript
87 lines
2.6 KiB
TypeScript
import { formatNodeServiceDescription } from "../daemon/constants.js";
|
|
import { resolveNodeProgramArguments } from "../daemon/program-args.js";
|
|
import { buildNodeServiceEnvironment } from "../daemon/service-env.js";
|
|
import type { GatewayServiceEnvironmentValueSource } from "../daemon/service-types.js";
|
|
import {
|
|
emitDaemonInstallRuntimeWarning,
|
|
resolveDaemonInstallRuntimeInputs,
|
|
resolveDaemonNodeBinDir,
|
|
} from "./daemon-install-plan.shared.js";
|
|
import type { DaemonInstallWarnFn } from "./daemon-install-runtime-warning.js";
|
|
import type { NodeDaemonRuntime } from "./node-daemon-runtime.js";
|
|
|
|
type NodeInstallPlan = {
|
|
programArguments: string[];
|
|
workingDirectory?: string;
|
|
environment: Record<string, string | undefined>;
|
|
environmentValueSources?: Record<string, GatewayServiceEnvironmentValueSource | undefined>;
|
|
description?: string;
|
|
};
|
|
|
|
function buildNodeInstallEnvironmentValueSources(): Record<
|
|
string,
|
|
GatewayServiceEnvironmentValueSource | undefined
|
|
> {
|
|
return {
|
|
OPENCLAW_GATEWAY_TOKEN: "file",
|
|
};
|
|
}
|
|
|
|
export async function buildNodeInstallPlan(params: {
|
|
env: Record<string, string | undefined>;
|
|
host: string;
|
|
port: number;
|
|
tls?: boolean;
|
|
tlsFingerprint?: string;
|
|
nodeId?: string;
|
|
displayName?: string;
|
|
runtime: NodeDaemonRuntime;
|
|
devMode?: boolean;
|
|
nodePath?: string;
|
|
warn?: DaemonInstallWarnFn;
|
|
}): Promise<NodeInstallPlan> {
|
|
const { devMode, nodePath } = await resolveDaemonInstallRuntimeInputs({
|
|
env: params.env,
|
|
runtime: params.runtime,
|
|
devMode: params.devMode,
|
|
nodePath: params.nodePath,
|
|
});
|
|
const { programArguments, workingDirectory } = await resolveNodeProgramArguments({
|
|
host: params.host,
|
|
port: params.port,
|
|
tls: params.tls,
|
|
tlsFingerprint: params.tlsFingerprint,
|
|
nodeId: params.nodeId,
|
|
displayName: params.displayName,
|
|
dev: devMode,
|
|
runtime: params.runtime,
|
|
nodePath,
|
|
});
|
|
|
|
await emitDaemonInstallRuntimeWarning({
|
|
env: params.env,
|
|
runtime: params.runtime,
|
|
programArguments,
|
|
warn: params.warn,
|
|
title: "Node daemon runtime",
|
|
});
|
|
|
|
const environment = buildNodeServiceEnvironment({
|
|
env: params.env,
|
|
// Match the gateway install path so supervised node services keep the chosen
|
|
// node toolchain on PATH for sibling binaries like npm/pnpm when needed.
|
|
extraPathDirs: resolveDaemonNodeBinDir(nodePath),
|
|
});
|
|
const description = formatNodeServiceDescription({
|
|
version: environment.OPENCLAW_SERVICE_VERSION,
|
|
});
|
|
|
|
return {
|
|
programArguments,
|
|
workingDirectory,
|
|
environment,
|
|
environmentValueSources: buildNodeInstallEnvironmentValueSources(),
|
|
description,
|
|
};
|
|
}
|