Add daemon host option and default to localhost instead of all addresses

This commit is contained in:
hensm
2022-08-16 00:16:17 +01:00
parent cb6e9226de
commit 170b80283d
3 changed files with 41 additions and 17 deletions

View File

@@ -6,16 +6,19 @@ import { __applicationVersion } from "../package.json";
const argv = minimist(process.argv.slice(2), {
boolean: ["daemon", "help", "version"],
string: ["__name", "port", "password"],
string: ["__name", "host", "port", "password"],
alias: {
d: "daemon",
h: "help",
v: "version",
p: "port"
n: "host",
p: "port",
P: "password"
},
default: {
__name: path.basename(process.argv[0]),
daemon: false,
host: "localhost",
port: "9556"
}
});
@@ -32,15 +35,17 @@ Options:
-h, --help Print usage info
-v, --version Print version info
-d, --daemon Launch in daemon mode. This starts a WebSocket server that
the extension can be configured to connect to under bridge
options.
-p, --port Set port number for WebSocket server. This must match the
port set in the extension options.
--password Set an optional password for the WebSocket server. This must
match the password set in the extension options.
WARNING: This password is intended only as a basic access
control measure and is transmitted in plain text even over
remote connections!
the extension can be configured to connect to under bridge
options.
-n, --host Host for daemon WebSocket server. This must match the host
set in the extension options.
-p, --port Port number for daemon WebSocket server. This must match the
port set in the extension options.
-P, --password Set an optional password for the daemon WebSocket server.
This must match the password set in the extension options.
WARNING: This password is intended only as a basic access
control measure and is transmitted in plain text even over
remote connections!
`
);
} else if (argv.daemon) {
@@ -51,7 +56,11 @@ Options:
}
import("./daemon").then(daemon => {
daemon.init(port, argv.password);
daemon.init({
host: argv.host,
port,
password: argv.password
});
});
} else {
import("./bridge");