fix(cli): explain port and gateway prompts

This commit is contained in:
Vincent Koc
2026-05-10 06:35:20 +08:00
parent e1a7ee6b2b
commit 554acb85a4
6 changed files with 29 additions and 17 deletions

View File

@@ -94,12 +94,12 @@ export async function runDaemonInstall(opts: DaemonInstallOptions) {
const cfg = configSnapshot.valid ? configSnapshot.sourceConfig : configSnapshot.config;
const portOverride = parsePort(opts.port);
if (opts.port !== undefined && portOverride === null) {
fail("Invalid port");
fail("Invalid --port. Use a port number from 1 to 65535, for example 18789.");
return;
}
const port = portOverride ?? resolveGatewayPort(cfg);
if (!Number.isFinite(port) || port <= 0) {
fail("Invalid port");
if (!Number.isFinite(port) || port <= 0 || port > 65_535) {
fail("Invalid Gateway port in config. Set gateway.port to a number from 1 to 65535.");
return;
}
const runtimeRaw = opts.runtime ? opts.runtime : DEFAULT_GATEWAY_DAEMON_RUNTIME;

View File

@@ -94,8 +94,8 @@ export async function runNodeDaemonInstall(opts: NodeDaemonInstallOptions) {
const config = await loadNodeHostConfig();
const { host, port } = resolveNodeDefaults(opts, config);
if (!Number.isFinite(port ?? Number.NaN) || (port ?? 0) <= 0) {
fail("Invalid port");
if (!Number.isFinite(port ?? Number.NaN) || (port ?? 0) <= 0 || (port ?? 0) > 65_535) {
fail("Invalid node host port. Use a port number from 1 to 65535.");
return;
}