Archived
1
0

use port from server.address() when printing URL (#780)

This allows the use of port 0, which is interpretted automatically to
mean "random port".

Additional logging consistency fixes.
This commit is contained in:
Dean Sheather 2019-06-17 17:20:20 +00:00 committed by Asher
parent cf63bbd003
commit a9d17882e7

View File

@ -279,10 +279,11 @@ const bold = (text: string | number): string | number => {
} : undefined, } : undefined,
}); });
logger.info("Starting webserver...", field("host", options.host), field("port", options.port));
if (options.socket) { if (options.socket) {
logger.info("Starting webserver via socket...", field("socket", options.socket));
app.server.listen(options.socket); app.server.listen(options.socket);
} else { } else {
logger.info("Starting webserver...", field("host", options.host), field("port", options.port));
app.server.listen(options.port, options.host); app.server.listen(options.port, options.host);
} }
let clientId = 1; let clientId = 1;
@ -323,14 +324,20 @@ const bold = (text: string | number): string | number => {
logger.warn("Launched without authentication."); logger.warn("Launched without authentication.");
} }
if (options.disableTelemetry) { if (options.disableTelemetry) {
logger.info("Telemetry is disabled"); logger.info(" ");
logger.info("Telemetry is disabled.");
} }
const protocol = options.allowHttp ? "http" : "https";
const url = `${protocol}://localhost:${options.port}/`;
logger.info(" "); logger.info(" ");
logger.info("Started (click the link below to open):"); if (options.socket) {
logger.info(url); logger.info("Started on socket address:");
logger.info(options.socket);
} else {
const protocol = options.allowHttp ? "http" : "https";
const url = `${protocol}://localhost:${app.server.address().port}/`;
logger.info("Started (click the link below to open):");
logger.info(url);
}
logger.info(" "); logger.info(" ");
if (options.open) { if (options.open) {