Archived
1
0

Catch error when openssl isn't installed

This commit is contained in:
Asher 2020-03-16 13:08:17 -05:00
parent 3463d56114
commit b52fbb4cb9
No known key found for this signature in database
GPG Key ID: D63C1EF81242354A
2 changed files with 8 additions and 3 deletions

@ -1 +1 @@
Subproject commit ae08d5460b5a45169385ff3fd44208f431992451
Subproject commit 78a4c91400152c0f27ba4d363eb56d2835f9903a

View File

@ -45,11 +45,16 @@ const main = async (args: Args): Promise<void> => {
} else if (args.cert && !args["cert-key"]) {
throw new Error("--cert-key is missing")
}
if (!args["disable-ssh"]) {
if (!options.sshHostKey && typeof options.sshHostKey !== "undefined") {
throw new Error("--ssh-host-key cannot be blank")
} else if (!options.sshHostKey) {
options.sshHostKey = await generateSshHostKey()
try {
options.sshHostKey = await generateSshHostKey()
} catch (error) {
logger.error("Unable to start SSH server", field("error", error.message))
}
}
}
@ -66,7 +71,7 @@ const main = async (args: Args): Promise<void> => {
logger.info(`code-server ${require("../../package.json").version}`)
let sshPort = ""
if (!args["disable-ssh"]) {
if (!args["disable-ssh"] && options.sshHostKey) {
const sshProvider = httpServer.registerHttpProvider("/ssh", SshProvider, options.sshHostKey as string)
sshPort = await sshProvider.listen()
}