fix(cli): preserve command option state

This commit is contained in:
Peter Steinberger
2026-05-24 01:04:04 +01:00
parent 308af85991
commit 15ff89bf5d
10 changed files with 78 additions and 32 deletions

View File

@@ -48,7 +48,7 @@ export function registerNodeCli(program: Command) {
.description("Run the headless node host (foreground)")
.option("--host <host>", "Gateway host")
.option("--port <port>", "Gateway port")
.option("--tls", "Use TLS for the gateway connection", false)
.option("--tls", "Use TLS for the gateway connection")
.option("--tls-fingerprint <sha256>", "Expected TLS certificate fingerprint (sha256)")
.option("--node-id <id>", "Override node id (clears pairing token)")
.option("--display-name <name>", "Override node display name")
@@ -67,8 +67,12 @@ export function registerNodeCli(program: Command) {
await runNodeHost({
gatewayHost: host,
gatewayPort: port,
gatewayTls: Boolean(opts.tls) || Boolean(opts.tlsFingerprint),
gatewayTlsFingerprint: opts.tlsFingerprint,
gatewayTls:
typeof opts.tls === "boolean"
? opts.tls
: Boolean(opts.tlsFingerprint ?? existing?.gateway?.tlsFingerprint) ||
existing?.gateway?.tls,
gatewayTlsFingerprint: opts.tlsFingerprint ?? existing?.gateway?.tlsFingerprint,
nodeId: opts.nodeId,
displayName: opts.displayName,
});