Archived
1
0

Include protocol on printed address

This makes it clickable from the terminal.
This commit is contained in:
Asher 2020-11-03 16:11:28 -06:00
parent e2c35facdb
commit a653b93ce2
No known key found for this signature in database
GPG Key ID: D63C1EF81242354A
2 changed files with 3 additions and 3 deletions

View File

@ -45,7 +45,7 @@ export const createApp = async (args: DefaultedArgs): Promise<[Express, http.Ser
} }
/** /**
* Get the address of a server as a string (protocol not included) while * Get the address of a server as a string (protocol *is* included) while
* ensuring there is one (will throw if there isn't). * ensuring there is one (will throw if there isn't).
*/ */
export const ensureAddress = (server: http.Server): string => { export const ensureAddress = (server: http.Server): string => {
@ -54,7 +54,7 @@ export const ensureAddress = (server: http.Server): string => {
throw new Error("server has no address") throw new Error("server has no address")
} }
if (typeof addr !== "string") { if (typeof addr !== "string") {
return `${addr.address}:${addr.port}` return `http://${addr.address}:${addr.port}`
} }
return addr return addr
} }

View File

@ -141,7 +141,7 @@ const main = async (args: DefaultedArgs): Promise<void> => {
if (args.link) { if (args.link) {
try { try {
await coderCloudBind(serverAddress, args.link.value) await coderCloudBind(serverAddress.replace(/^https?:\/\//, ""), args.link.value)
logger.info(" - Connected to cloud agent") logger.info(" - Connected to cloud agent")
} catch (err) { } catch (err) {
logger.error(err.message) logger.error(err.message)